code: def insert(self, optional_root_locations_path):
          
          encountered_simple_optional = False
          parent_location = self._root_location
          for optional_root_location in optional_root_locations_path:
              if encountered_simple_optional:
                  raise AssertionError(u'Encountered simple optional root location {} in path, but'
                                       u'further locations are present. This should not happen: {}'
                                       .format(optional_root_location, optional_root_locations_path))
  
              if optional_root_location not in self._location_to_children:
                  # Simple optionals are ignored.
                  # There should be no complex optionals after a simple optional.
                  encountered_simple_optional = True
              else:
                  self._location_to_children[parent_location].add(optional_root_location)
                  parent_location = optional_root_location
docs: Insert a path of optional Locations into the tree.
  
          Each OptionalTraversalTree object contains child Location objects as keys mapping to
          other OptionalTraversalTree objects.
  
          Args:
              optional_root_locations_path: list of optional root Locations all except the last
                                            of which must be present in complex_optional_roots