import itertools


def autosummary(names):
    """ Generate reST automodule directive for the given module.

    :Examples:

    >>> autosummary(['my.test.module', 'my.test.module2'])
    '''
    .. autosummary::

        my.test.module1
        my.test.module2

    <BLANKLINE>
    '''

    """
    lines = itertools.chain(
        [
            '',
            '.. autosummary::',
            ''
        ],
        ['    {}'.format(name) for name in names],
        ['']
    )
    return '\n'.join(lines)