code: def finder(package):
      
      if package in _finder_cache:
          result = _finder_cache[package]
      else:
          if package not in sys.modules:
              __import__(package)
          module = sys.modules[package]
          path = getattr(module, '__path__', None)
          if path is None:
              raise DistlibException('You cannot get a finder for a module, '
                                     'only for a package')
          loader = getattr(module, '__loader__', None)
          finder_maker = _finder_registry.get(type(loader))
          if finder_maker is None:
              raise DistlibException('Unable to locate finder for %r' % package)
          result = finder_maker(module)
          _finder_cache[package] = result
      return result
docs: Return a resource finder for a package.
      :param package: The name of the package.
      :return: A :class:`ResourceFinder` instance for the package.