Try to get elt embedding elements.

    :param embedding: embedding element. Must have a module.

    :return: a list of [module [,class]*] embedding elements which define elt.
    :rtype: list
171213
def find_embedding(elt, embedding=None):
    

    result = []  # result is empty in the worst case

    # start to get module
    module = getmodule(elt)

    if module is not None:  # if module exists

        visited = set()  # cache to avoid to visit twice same element

        if embedding is None:
            embedding = module

        # list of compounds elements which construct the path to elt
        compounds = [embedding]

        while compounds:  # while compounds elements exist
            # get last compound
            last_embedding = compounds[-1]
            # stop to iterate on compounds when last embedding is elt
            if last_embedding == elt:
                result = compounds  # result is compounds
                break

            else:
                # search among embedded elements
                for name in dir(last_embedding):
                    # get embedded element
                    embedded = getattr(last_embedding, name)

                    try:  # check if embedded has already been visited
                        if embedded not in visited:
                            visited.add(embedded)  # set it as visited

                        else:
                            continue

                    except TypeError:
                        pass

                    else:

                        # get embedded module
                        embedded_module = getmodule(embedded)
                        # and compare it with elt module
                        if embedded_module is module:
                            # add embedded to compounds
                            compounds.append(embedded)
                            # end the second loop
                            break

                else:
                    # remove last element if no coumpound element is found
                    compounds.pop(-1)

    return result
1187538
def _lookup_element(lst, key):
    '''
    
    '''
    if not lst:
        return {}
    for ele in lst:
        if not ele or not isinstance(ele, dict):
            continue
        if ele.keys()[0] == key:
            return ele.values()[0]
    return {}
341993
def get_layers(self, class_: Type[L], became: bool=True) -> List[L]:
        

        out = self._index.get(class_, [])

        if became:
            out += self._transformed.get(class_, [])

        return out
585750
def cb(self, elt, sw, pyobj, unsuppressedPrefixes=[]):
        
        #if sw.Known(pyobj): 
        #    return

        if type(pyobj) in _stringtypes:
            elt.createAppendTextNode(pyobj)
            return

        ## grab document and import node, and append it
        doc = elt.getDocument()
        node = doc.importNode(pyobj, deep=1)
        child = elt.node.appendChild(node)

        ## copy xmlns: attributes into appended node
        parent = pyobj.parentNode
        while parent.nodeType == _Node.ELEMENT_NODE:
            for attr in filter(lambda a: a.name.startswith('xmlns:') and a.name not in child.attributes.keys(), parent.attributes): 
                child.setAttributeNode(attr.cloneNode(1))

            parent = parent.parentNode
577054
def get_cls_doc(elt, full_name:str)->str:
    ""
    parent_class = inspect.getclasstree([elt])[-1][0][1][0]
    name,args = format_ft_def(elt, full_name)
    if parent_class != object: args += f' :: {link_type(parent_class, include_bt=True)}'
    return name,args
260589
def find_elements(self):
        
        es = []
        for element_id in self.find_element_ids():
            e = Element(self.http.new_client(''), element_id)
            es.append(e)
        return es
1103453
def list_to_serialized(ref, the_list):
    
    result = []
    for elt in the_list:
        if not getattr(elt, 'serialize', None):
            continue
        result.append(elt.serialize())
    return result
715465
def _ensure_element(tup, elem):
    
    try:
        return tup, tup.index(elem)
    except ValueError:
        return tuple(chain(tup, (elem,))), len(tup)
1300074
def _element_find_from_root(
        root,  # type: ET.Element
        element_path  # type: Text
):
    # type: (...) -> Optional[ET.Element]
    
    element = None

    element_names = element_path.split('/')
    if element_names[0] == root.tag:
        if len(element_names) > 1:
            element = root.find('/'.join(element_names[1:]))
        else:
            element = root

    return element
585481
def flatten(ele):
        
        for el in ele:
            if isinstance(el, list) or isinstance(el, tuple):
                for e in Models.flatten(el):
                    yield e
            else:
                yield el
1298799
def doc(elt):
    ""
    global use_relative_links
    use_relative_links = False
    elt = getattr(elt, '__func__', elt)
    md = show_doc(elt, markdown=False)
    if is_fastai_class(elt):
        md += f'\n\n<a href="{get_fn_link(elt)}" target="_blank" rel="noreferrer noopener">Show in docs</a>'
    output = HTMLExporter().markdown2html(md)
    use_relative_links = True
    if IS_IN_COLAB: get_ipython().run_cell_magic(u'html', u'', output)
    else:
        try: page.page({'text/html': output})
        except: display(Markdown(md))
239184
public List<Embeddable<EntityMappings<T>>> getAllEmbeddable()
   {
      List<Embeddable<EntityMappings<T>>> list = new ArrayList<Embeddable<EntityMappings<T>>>();
      List<Node> nodeList = childNode.get("embeddable");
      for(Node node: nodeList)
      {
         Embeddable<EntityMappings<T>>  type = new EmbeddableImpl<EntityMappings<T>>(this, "embeddable", childNode, node);
         list.add(type);
      }
      return list;
   }
871366
def as_dict(self):
        
        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "element": self.symbol}
1188493
def _get_ctypes(self):
        
        ctypes = []
        for related_object in self.model._meta.get_all_related_objects():
            model = getattr(related_object, 'related_model', related_object.model)
            ctypes.append(ContentType.objects.get_for_model(model).pk)
            if model.__subclasses__():
                for child in model.__subclasses__():
                    ctypes.append(ContentType.objects.get_for_model(child).pk)
        return ctypes
901058
public List<ElementCollection<EmbeddableAttributes<T>>> getAllElementCollection()
   {
      List<ElementCollection<EmbeddableAttributes<T>>> list = new ArrayList<ElementCollection<EmbeddableAttributes<T>>>();
      List<Node> nodeList = childNode.get("element-collection");
      for(Node node: nodeList)
      {
         ElementCollection<EmbeddableAttributes<T>>  type = new ElementCollectionImpl<EmbeddableAttributes<T>>(this, "element-collection", childNode, node);
         list.add(type);
      }
      return list;
   }
1061279
def find_stack_elements(self, module, module_name="", _visited_modules=None):
        
        from types import ModuleType
        if _visited_modules is None: _visited_modules = []
        _visited_modules.append(module)
        #
        elements = []
        for el_name in dir(module):
            the_el = module.__getattribute__(el_name)
            if isinstance(the_el, ModuleType):
                # Recursively go into the module
                if the_el in _visited_modules:
                    continue
                elements = elements + self.find_stack_elements(the_el, module_name + el_name + ".", _visited_modules)
            elif isinstance(the_el, StackElement):
                # Add to list
                elements.append((module_name, el_name, the_el))
        return elements
704622
def getSubstitutionElement(self, elt, ps):
        '''
        '''
        nsuri,ncname = _get_element_nsuri_name(elt)
        typecode = GED(nsuri,ncname)
        if typecode is None:
            return

        try:
            nsuri,ncname = typecode.substitutionGroup
        except (AttributeError, TypeError):
            return

        if (ncname == self.pname) and (nsuri == self.nspname or 
           (not nsuri and not self.nspname)):
             return typecode
       
        return