Get object by numeric id or exact
		and unique part of specified attrs (name, title, etc).
331196
def get_by_string(cls, fields, query):
	''''''
	try: pk = int(query)
	except ValueError: pass
	else: return cls.objects.get(pk=pk)
	obj = list(cls.objects.filter(reduce( op.or_,
		list(Q(**{'{}__icontains'.format(f): query}) for f in fields) )))
	if len(obj) > 1:
		raise cls.MultipleObjectsReturned((
			u'Unable to uniquely identify {}'
				' by provided criteria: {!r} (candidates: {})' )\
			.format(cls.__name__, query, ', '.join(it.imap(unicode, obj))) )
	elif not len(obj):
		raise cls.DoesNotExist(
			u'Unable to find site by provided criteria: {!r}'.format(query) )
	return obj[0]
1306225
def get_object_by_name(self, name):
        
        for obj in self.objects:
            if obj.name == name:
                return obj
        raise ValueError
824453
def get_attr(self, method_name):
        """"""
        return self.attrs.get(method_name) or self.get_callable_attr(method_name)
349969
def match_id(self, el, ids):
        """"""

        found = True
        for i in ids:
            if i != self.get_attribute_by_name(el, 'id', ''):
                found = False
                break
        return found
589173
def _fetch_objects(self, key, value):
        """"""
        return self.to_cls.query.filter(**{key: value})
1020862
def get(self, attr: FetchAttribute) -> MaybeBytes:
        
        attr_name = attr.value.decode('ascii')
        method = getattr(self, '_get_' + attr_name.replace('.', '_'))
        return method(attr)
60495
def OnGetItemAttr(self, item):
        """"""
        if self.indicated > -1 and item == self.indicated:
            return self.indicated_attribute
        return None
1082196
def _get_object(data, position, obj_end, opts):
    """"""
    obj_size = _UNPACK_INT(data[position:position + 4])[0]
    end = position + obj_size - 1
    if data[end:position + obj_size] != b"\x00":
        raise InvalidBSON("bad eoo")
    if end >= obj_end:
        raise InvalidBSON("invalid object length")
    obj = _elements_to_dict(data, position + 4, end, opts, subdocument=True)

    position += obj_size
    if "$ref" in obj:
        return (DBRef(obj.pop("$ref"), obj.pop("$id", None),
                      obj.pop("$db", None), obj), position)
    return obj, position
1014198
function findAttribute(attrs, propName) {
    var index = Object.keys(attrs).filter(function (attr) {
      return attr.toLowerCase() === propName.toLowerCase();
    })[0];
    return attrs[index];
  }
1014863
def get_attrs(cls):
        
        ignore = dir(type('dummy', (object,), {})) + ['__metaclass__']
        attrs = [
            item for item in inspect.getmembers(cls) if item[0] not in ignore
            and not isinstance(
                item[1], (
                    types.FunctionType,
                    types.MethodType,
                    classmethod,
                    staticmethod,
                    property))]
        # sort by idx and use attribute name to break ties
        attrs.sort(key=lambda attr: (getattr(attr[1], 'idx', -1), attr[0]))
        return attrs
1153893
def find_one(self, cls, id):
        """"""
        try:
            db_result = self.get_class_table(cls).lookup(id)
        except ItemNotFound:
            # according to docs, this shouldn't be required, but it IS
            db_result = None

        if not db_result:
            return None

        obj = cls.from_data(db_result['value'])
        return obj
617976
def load_object_by_name(object_name):
    """"""
    mod_name, attr = object_name.rsplit('.', 1)
    mod = import_module(mod_name)
    return getattr(mod, attr)
1211449
def getitem(self, obj, argument):
        """"""
        try:
            return obj[argument]
        except (TypeError, LookupError):
            if isinstance(argument, basestring):
                try:
                    attr = str(argument)
                except:
                    pass
                else:
                    try:
                        value = getattr(obj, attr)
                    except AttributeError:
                        pass
                    else:
                        if self.is_safe_attribute(obj, argument, value):
                            return value
                        return self.unsafe_undefined(obj, argument)
        return self.undefined(obj=obj, name=argument)
1033504
def get_object_by_name(content, object_type, name, regex=False):
    '''
    
    '''
    container = content.viewManager.CreateContainerView(
        content.rootFolder, [object_type], True
    )
    for c in container.view:
        if regex:
            if re.match(name, c.name):
                return c
        elif c.name == name:
            return c
59782
def get_id2upper(objs):
    """"""
    id2upper = {}
    for obj in objs:
        _get_id2upper(id2upper, obj.item_id, obj)
    return id2upper
476218
def attrgetcol(self, groupname, attrname):
        """"""
        values = []
        for rownr in range(self.attrnrows(groupname)):
            values.append(self.attrget(groupname, attrname, rownr))
        return values
537986
def get(self, key, default=None):
        """"""
        if type(self.attrs) == dict:
            return self.attrs.get(key, default)
        else:
            raise NotImplementedError