code: def _element_get_or_add_from_parent(
          parent,  # type: ET.Element
          element_path  # type: Text
  ):
      # type: (...) -> ET.Element
      
      element_names = element_path.split('/')
  
      # Starting from the parent, walk the element path until we find the first element in the path
      # that does not exist. Create that element and all the elements following it in the path. If
      # all elements along the path exist, then we will simply walk the full path to the final
      # element we want to return.
      existing_element = None
      previous_element = parent
      for i, element_name in enumerate(element_names):
          existing_element = previous_element.find(element_name)
          if existing_element is None:
              existing_element = _element_append_path(previous_element, element_names[i:])
              break
  
          previous_element = existing_element
  
      assert existing_element is not None
      return existing_element
docs: Ensure all elements specified in the given path relative to the provided parent element exist.
  
      Create new elements along the path only when needed, and return the final element specified
      by the path.