def create_index(modules):
    '''This takes a dict of modules and created the RST index file.'''
    for key in modules.keys():
        file_path = join(HERE, '%s_modules/_list_of_modules.rst' % key)
        list_file = open(file_path, 'w')

        # Write the generic header
        list_file.write('%s\n' % AUTOGEN)
        list_file.write('%s\n' % key.title())
        list_file.write('=' * len(key))
        list_file.write('\n\n')
        list_file.write('.. toctree::\n')
        list_file.write('   :maxdepth: 2\n\n')

        for module in modules[key]:
            list_file.write('   %s\n' % module)
This takes a dict of modules and created the RST index file.