code: def create_modules_toc_file(master_package, modules, opts, name='modules'):
      
      text = format_heading(1, '%s Modules' % opts.header)
      text += '.. toctree::\n'
      text += '   :maxdepth: %s\n\n' % opts.maxdepth
  
      modules.sort()
      prev_module = ''
      for module in modules:
          # look if the module is a subpackage and, if yes, ignore it
          if module.startswith(prev_module + '.'):
              continue
          prev_module = module
          text += '   %s\n' % module
  
      write_file(name, text, opts)
docs: Create the module's index.