docs: def MatchBestComponentName(self, component):
      """Returns the name of the component which matches best our base listing.
  
      In order to do the best case insensitive matching we list the files in the
      base handler and return the base match for this component.
  
      Args:
        component: A component name which should be present in this directory.
  
      Returns:
        the best component name.
      """
      fd = self.OpenAsContainer()
  
      # Adjust the component casing
      file_listing = set(fd.ListNames())
  
      # First try an exact match
      if component not in file_listing:
        # Now try to match lower case
        lower_component = component.lower()
        for x in file_listing:
          if lower_component == x.lower():
            component = x
            break
  
      if fd.supported_pathtype != self.pathspec.pathtype:
        new_pathspec = rdf_paths.PathSpec(
            path=component, pathtype=fd.supported_pathtype)
      else:
        new_pathspec = self.pathspec.last.Copy()
        new_pathspec.path = component
  
      return new_pathspec