import configparser
import click


def get_config_item(config, section, item):
    """
    Get the value of a config item and
    throws a ClickException if it doesn't exist
    """
    try:
        return config.get(section, item)
    except (configparser.NoOptionError, configparser.NoSectionError, configparser.InterpolationSyntaxError):
        error_msg = ('The item "{0}" is not set correctly in the "{1}" section '
                     'in your config file.'.format(item, section))
        raise click.ClickException(error_msg)