import click


def user_callback(_ctx, param, value):
    """Testing callback that transforms a missing value to -1 and otherwise only accepts 42."""
    if not value:
        return -1

    if value != 42:
        raise click.BadParameter('invalid integer', param=param)

    return value