def config_to_dict(config):
    """
    Return a dict of dicts representing the configparser instance
    ``config``.

    The outer keys are section names, the inner keys are option
    names, and the inner values are the option values. For example,
    this input to configparser:

        [Meta]
        title: Dead Parrot Sketch
        aired: 7 December 1969
        [Actors]
        customer: John Cleese
        shopkeeper: Michael Palin

    ...would result in the following structure:

        {
            'Meta': {
                'title': 'Dead Parrot Sketch',
                'aired': '7 December 1969',
            },
            'Actors': {
                'customer': 'John Cleese',
                'shopkeeper': 'Michael Palin',
            },
        }

    """
    return dict(
        (section, dict(config.items(section)))
        for section in config.sections()
    )