code: def create_autosummary_file(modules, opts):
      # type: (List[unicode], Any, unicode) -> None
      
      lines = [
          'API Reference',
          '=============',
          '',
          '.. autosummary::',
          '   :template: api_module.rst',
          '   :toctree: {}'.format(opts.destdir),
          '',
      ]
  
      modules.sort()
      for module in modules:
          lines.append('   {}'.format(module))
      lines.append('')
  
      fname = path.join(opts.srcdir, '{}.rst'.format(opts.docname))
      logger.info('[apigen] creating API docs file: {}'.format(fname))
      with FileAvoidWrite(fname) as f:
          f.write('\n'.join(lines))
docs: Create the module's index.