find the child object by name and return the object
168312
def get_child_by_name(self, name):
        
        for c in self.child_nodes:
            if c.name == name:
                return c
        return None
737253
def _find_controller(self, *args):
        '''
        
        '''
        for name in args:
            obj = self._lookup_child(name)
            if obj and iscontroller(obj):
                return obj
        return None
269368
def get_object_by_type(self, *types):
        
        children = self.get_objects_by_type(*types)
        return children[0] if any(children) else None
611052
def get_child_value(parent, name, allow_missing=0):
        
        if not parent.HasElement(name):
            if allow_missing:
                return np.nan
            else:
                raise Exception('failed to find child element %s in parent' % name)
        else:
            return XmlHelper.as_value(parent.GetElement(name))
892734
def __find_object_children(self, obj) -> dict:
        
        if hasattr(obj, 'items') and \
                isinstance(obj.items, types.BuiltinFunctionType):
            return self.__construct_object(obj)
        elif isinstance(obj, (list, tuple, set)):
            return self.__construct_list(obj)
        else:
            exclude_list = []
            if hasattr(obj, '_sa_instance_state'):
                # load only deferred objects
                if len(orm.attributes.instance_state(obj).unloaded) > 0:
                    mapper = inspect(obj)
                    for column in mapper.attrs:
                        column.key
                        column.value
            if hasattr(obj, 'json_exclude_list'):
                # do not serialize any values in this list
                exclude_list = obj.json_exclude_list
            return self.__construct_object(vars(obj), exclude_list)
        return None
345231
def getChild(self, name, request):
        
        request.prepath = []
        request.postpath.insert(0, name)
        # re-establishes request.postpath so to contain the entire path
        return self.wsgi_resource
362068
function sortByName(child1, child2) {
            var ret = checkStatesFirst(child1, child2);
            if (ret) return ret;

            var o1 = objects[child1.key], o2 = objects[child2.key];
            if (o1 && o2) {
                var c1 = o1.common, c2 = o2.common;
                if (c1 && c2) {

                    // var s1 = child1.key.substr(0, child1.key.lastIndexOf('.')); // faster than regexp.
                    // var s2 = child2.key.substr(0, child2.key.lastIndexOf('.'));
                    // if (s1 > s2) return 1;
                    // if (s1 < s2) return -1;

                    if (!data.sortConfig.ignoreSortOrder && c1.sortOrder && c2.sortOrder) {
                        if (c1.sortOrder > c2.sortOrder) return 1;
                        if (c1.sortOrder < c2.sortOrder) return -1;
                        return 0;
                    }
                    var name1;
                    var name2;
                    if (c1.name) {
                        name1 = c1.name;
                        if (typeof name1 === 'object') {
                            name1 = (name1[systemLang] || name1.en).toLowerCase();
                        } else {
                            name1 = name1.toLowerCase();
                        }
                    } else {
                        name1 = child1.key;
                    }
                    if (c2.name) {
                        name2 = c2.name;
                        if (typeof name2 === 'object') {
                            name2 = (name2[systemLang] || name2.en).toLowerCase();
                        } else {
                            name2 = name2.toLowerCase();
                        }
                    } else {
                        name2 = child1.key;
                    }
                    if (name1 > name2) return 1;
                    if (name1 < name2) return -1;
                }
            }
            if (child1.key > child2.key) return 1;
            if (child1.key < child2.key) return -1;
            return 0;
        }
336030
def named_object(name):
    """"""
    name_parts = name.split('.')
    module = named_module('.'.join(name_parts[:-1]))
    return getattr(module, name_parts[-1])
1126978
def get_id2children(objs):
    """"""
    id2children = {}
    for obj in objs:
        _get_id2children(id2children, obj.item_id, obj)
    return id2children
131693
def _get_object(data, position, obj_end, opts, dummy):
    """"""
    obj_size, end = _get_object_size(data, position, obj_end)
    if _raw_document_class(opts.document_class):
        return (opts.document_class(data[position:end + 1], opts),
                position + obj_size)

    obj = _elements_to_dict(data, position + 4, end, opts)

    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
652235
def getNodeByName(node, name):
    

    if node is None:
        raise Exception(
            "Cannot search for a child '%s' in a None object" % (name,)
        )
    if not name:
        raise Exception("Unspecified name to find node for.")
    try:
        childNode = node.xpath("*[local-name() = '%s']" % name)[0]
    except:
        return None
    return childNode
607078
def get_child(parent, child_index):
    
    if child_index < 0 or child_index >= len(parent.childNodes):
        return None
    return parent.childNodes[child_index]
64927
def child(self, local_name=None, name=None, ns_uri=None, node_type=None,
            filter_fn=None):
        
        return self.children(name=name, local_name=local_name, ns_uri=ns_uri,
            node_type=node_type, filter_fn=filter_fn, first_only=True)
246241
def get_child(self, streamId, childId, options={}):
        """"""
        return self.get('stream/' + streamId + '/children/' + childId, options)
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
501761
def get_child(self, child_name):  # pylint: disable=no-self-use
        
        child = self.children.get(child_name, None)
        if child:
            return child
        raise ValueError("Value {} not in this tree".format(child_name))
1047377
def get(cls, parent, name):
        """"""
        return cls.query.filter_by(parent=parent, name=name).one_or_none()