code: def make_index_for(package, index_dir, verbose=True):
      
      index_template = """\
  <html>
  <head><title>{title}</title></head>
  <body>
  <h1>{title}</h1>
  <ul>
  {packages}
  </ul>
  </body>
  </html>
  """
      item_template = '<li><a href="{1}">{0}</a></li>'
      index_filename = os.path.join(index_dir, "index.html")
      if not os.path.isdir(index_dir):
          os.makedirs(index_dir)
  
      parts = []
      for pkg_filename in package.files:
          pkg_name = os.path.basename(pkg_filename)
          if pkg_name == "index.html":
              # -- ROOT-INDEX:
              pkg_name = os.path.basename(os.path.dirname(pkg_filename))
          else:
              pkg_name = package.splitext(pkg_name)
          pkg_relpath_to = os.path.relpath(pkg_filename, index_dir)
          parts.append(item_template.format(pkg_name, pkg_relpath_to))
  
      if not parts:
          print("OOPS: Package %s has no files" % package.name)
          return
  
      if verbose:
          root_index = not Package.isa(package.files[0])
          if root_index:
              info = "with %d package(s)" % len(package.files)
          else:
              package_versions = sorted(set(package.versions))
              info = ", ".join(reversed(package_versions))
          message = "%-30s  %s" % (package.name, info)
          print(message)
  
      with open(index_filename, "w") as f:
          packages = "\n".join(parts)
          text = index_template.format(title=package.name, packages=packages)
          f.write(text.strip())
          f.close()
docs: Create an 'index.html' for one package.
  
      :param package:   Package object to use.
      :param index_dir: Where 'index.html' should be created.