code: def AddPathSegment(self, path_segment, scan_object):
      
      if path_segment in self._path_segments:
        raise ValueError('Path segment already set.')
  
      if isinstance(scan_object, PathFilterScanTreeNode):
        scan_object.parent = self
  
      self._path_segments[path_segment] = scan_object
docs: Adds a path segment.
  
      Args:
        path_segment: a string containing the path segment.
        scan_object: a scan object, either a scan tree sub node (instance of
                     PathFilterScanTreeNode) or a string containing a path.
  
      Raises:
        ValueError: if the node already contains a scan object for
                    the path segment.