code: def create_top_level_index(api_docs_path, packages, max_depth=2):
      
      page_text = INDEX_HEADER
      for package in packages:
          # Write top level index file entries for safe
          text = create_top_level_index_entry(
              title='Package %s' % package,
              max_depth=max_depth,
              subtitles=[package])
  
          page_text += '%s\n' % text
      write_rst_file(api_docs_path, 'index', page_text)
docs: Create the top level index page (writing to file)
  
      :param api_docs_path: Path to the api-docs of inasafe documentation.
      :type api_docs_path: str
  
      :param packages: List of packages which want to be extracted their api/
      :type packages: list
  
      :param max_depth: The maximum depth of tree in the api docs.
      :type max_depth: int