Lookup an event by name.

        :param str item: Event name
        :return Event: Event instance under key
558304
def get_event(self, name, default=_sentinel):
        
        if name not in self.events:
            if self.create_events_on_access:
                self.add_event(name)
            elif default is not _sentinel:
                return default
        return self.events[name]
1130158
def get_alert(thing_name, key, session=None):
    
    return _request('get', '/get/alert/for/{0}'.format(thing_name), params={'key': key}, session=session)
987057
def index(self, item, **kwargs):
        # type: (Any, dict) -> int
        
        return list.index(self, self.ref(item), **kwargs)
631935
def index(self, item):
        
        for i, x in enumerate(self.iter()):
            if x == item:
                return i
        return None
178318
def match(self, item):
        
        result = self._value == getattr(item, self._name)
        #log.debug("%r for %r = %r, name %r, item %r" % (
        #    result, getattr(item, self._name), self._value, self._name, item))
        return result
368041
def get(self, item):
        
        if item not in self._item_cache:
            try:
                item = self.__getitem__(item)
            except KeyError:
                item = None
            self._item_cache[item] = item
        return self._item_cache[item]
225831
def get(self, item, default_value=None):
        

        found, name = self._contains_and_name(item)
        if found:
            return self._record_map[name]['value']
        else:
            return default_value
400227
def item_after(self, item):
        
        next_iter = self._next_iter_for(item)
        if next_iter is not None:
            return self._object_at_iter(next_iter)
1159296
def refresh(self, item):
        
        client = self._clients[item].get_client()
        self[item] = val = self.item_class(client)
        return val
1234777
def get_parameter(self, name, default=None):
        '''
        
        '''
        if hasattr(self, name):
            item = getattr(self, name)
            if isinstance(item, Parameter):
                return item
        return default
984923
def get_item_key(self, item):
        """"""
        try:
            ret = item[item['key']]
        except KeyError:
            logger.error("No 'key' available in {}".format(item))
        if isinstance(ret, list):
            return ret[0]
        else:
            return ret
123163
def event_lookup_query(self, id, **kwargs):
        
        if not id:
            raise ValueError('A valid event ID (parameter "id") must be provided.')

        return self._query(EVENT_LOOKUP_API_URL.format(id), **kwargs)
916882
def match(self, item):
        
        if 0 and getattr(item, self._name):
            print "%r %r %r %r %r %r" % (self._cmp(float(getattr(item, self._name)), self._value),
                  self._name, self._condition, item.name, getattr(item, self._name), self._value)
        val = getattr(item, self._name) or 0
        if self.not_null and self._value and not val:
            return False
        else:
            return self._cmp(float(val), self._value)
882304
def match(self, item):
        
        val = (getattr(item, self._name) or '').lower()
        result = self._matcher(val) if self._is_regex else self._matcher(val, item)
        if 0:
            log.debug("%r for %r ~ %r, name %r, item %r" % (
                result, val, self._value, self._name, item))
        return result
137130
def get_item(self, key):
        
        result = self._db.search(self._urls.key == key)
        return result[0].get('url') if result else None
156961
def event_emitter(cls_=None, *, events=('*', )):
    

    # create a dictionary from items in the 'events' parameter and with empty
    # lists as values
    event_dict = dict.fromkeys(events, [])

    # if '*' was in the events tuple - then pop it out of the event_dict
    # and store the fact that we may allow any event name to be added to the
    # event emitter.
    allow_any_eventname = event_dict.pop('*', False) == []

    def _event_emitter(cls):

        def on(self, name, callback):
            """
            Add a callback to the event named 'name'. Returns the object for
            chained 'on' calls.
            """
            if not (callable(callback) or isawaitable(callback)):
                raise ValueError("Callback not callable: %r" % callback)

            try:
                event_dict[name].append(callback)
            except KeyError:
                if allow_any_eventname:
                    event_dict[name] = [callback]
                else:
                    msg = "Event Emitter has no event {!r}".format(name)
                    raise KeyError(msg)

            return self

        async def emit(self, name):
            """
            Coroutine which executes each of the callbacks added to the event
            identified by 'name'
            """
            for cb in event_dict[name]:
                if isawaitable(cb):
                    await cb
                else:
                    cb()

        cls.on = on
        cls.emit = emit

        return cls

    if cls_ is None:
        return _event_emitter
    else:
        return _event_emitter(cls_)
1040452
def _get_item(list_containing_dicts_entries, attribute_value,
                  attribute_name='subnet_id'):
        
        for item in list_containing_dicts_entries:
            if item.get(attribute_name) == attribute_value:
                return item
        return {}