import click


def validate_section(ctx, param, value):
    """
    Validate that a given section exists.
    """
    config = ctx.obj.config
    if value and config.has_section(value):
        raise click.BadParameter(
            'Missing or unknown section: {}'.format(value))
    return value