code: def dist_factory(path_item, entry, only):
      
      lower = entry.lower()
      is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info')))
      return (
          distributions_from_metadata
          if is_meta else
          find_distributions
          if not only and _is_egg_path(entry) else
          resolve_egg_link
          if not only and lower.endswith('.egg-link') else
          NoDists()
      )
docs: Return a dist_factory for a path_item and entry