(self, namespace, identifier)
return found_element
Finds an element with a particular identifier.

    This function allows the direct access to an arbitrarily deeply nested
    child element by name, without the need to manually traverse through the
    object tree. The `namespace` argument specifies the kind of element to
    find. In most cases, this corresponds to the element's XML tag name.
    However, if an element has multiple specialized tags, then the namespace
    corresponds to the tag name of the most general element of that kind.
    For example, `namespace='joint'` would search for `<joint>` and
    `<freejoint>`, while `namespace='actuator'` would search for `<general>`,
    `<motor>`, `<position>`, `<velocity>`, and `<cylinder>`.

    Args:
      namespace: A string specifying the namespace being searched. See the
        docstring above for explanation.
      identifier: The identifier string of the desired element.

    Returns:
      An `mjcf.Element` object, or `None` if an element with the specified
      identifier is not found.

    Raises:
      ValueError: if either `namespace` or `identifier` is not a string, or if
        `namespace` is not a valid namespace.
Finds an element with a particular identifier.
Finds an element with a particular identifier .
def find(self, namespace, identifier):
    """Finds an element with a particular identifier.

    This function allows the direct access to an arbitrarily deeply nested
    child element by name, without the need to manually traverse through the
    object tree. The `namespace` argument specifies the kind of element to
    find. In most cases, this corresponds to the element's XML tag name.
    However, if an element has multiple specialized tags, then the namespace
    corresponds to the tag name of the most general element of that kind.
    For example, `namespace='joint'` would search for `<joint>` and
    `<freejoint>`, while `namespace='actuator'` would search for `<general>`,
    `<motor>`, `<position>`, `<velocity>`, and `<cylinder>`.

    Args:
      namespace: A string specifying the namespace being searched. See the
        docstring above for explanation.
      identifier: The identifier string of the desired element.

    Returns:
      An `mjcf.Element` object, or `None` if an element with the specified
      identifier is not found.

    Raises:
      ValueError: if either `namespace` or `identifier` is not a string, or if
        `namespace` is not a valid namespace.
    """
    if not isinstance(namespace, str):
      raise ValueError(
          '`namespace` should be a string: got {!r}'.format(namespace))
    if not isinstance(identifier, str):
      raise ValueError(
          '`identifier` should be a string: got {!r}'.format(identifier))
    if namespace not in schema.FINDABLE_NAMESPACES:
      raise ValueError('{!r} is not a valid namespace. Available: {}.'.format(
          namespace, schema.FINDABLE_NAMESPACES))
    if constants.PREFIX_SEPARATOR in identifier:
      scope_name = identifier.split(constants.PREFIX_SEPARATOR)[0]
      try:
        attachment = self.namescope.get('attached_model', scope_name)
        found_element = attachment.find(
            namespace, identifier[(len(scope_name) + 1):])
      except (KeyError, ValueError):
        found_element = None
    else:
      try:
        found_element = self.namescope.get(namespace, identifier)
      except KeyError:
        found_element = None
      if found_element and self._parent:
        next_parent = found_element.parent
        while next_parent and next_parent != self:
          next_parent = next_parent.parent
        if not next_parent:
          found_element = None
    return found_element
def find ( self , namespace , identifier ) : if not isinstance ( namespace , str ) : raise ValueError ( '`namespace` should be a string: got {!r}' . format ( namespace ) ) if not isinstance ( identifier , str ) : raise ValueError ( '`identifier` should be a string: got {!r}' . format ( identifier ) ) if namespace not in schema . FINDABLE_NAMESPACES : raise ValueError ( '{!r} is not a valid namespace. Available: {}.' . format ( namespace , schema . FINDABLE_NAMESPACES ) ) if constants . PREFIX_SEPARATOR in identifier : scope_name = identifier . split ( constants . PREFIX_SEPARATOR ) [ 0 ] try : attachment = self . namescope . get ( 'attached_model' , scope_name ) found_element = attachment . find ( namespace , identifier [ ( len ( scope_name ) + 1 ) : ] ) except ( KeyError , ValueError ) : found_element = None else : try : found_element = self . namescope . get ( namespace , identifier ) except KeyError : found_element = None if found_element and self . _parent : next_parent = found_element . parent while next_parent and next_parent != self : next_parent = next_parent . parent if not next_parent : found_element = None return found_element