import click


def validate_name(ctx: click.Context, param: click.Option, value: str) -> str:
    """
    Validate that the name is a reasonable length.
    :param ctx: see callbacks for click options
    :param param: see callbacks for click options
    :param value: see callbacks for click options
    :return: Validated name otherwise a click.BadParameter exception is raised
    """
    if value is None or len(value) > 20:
        raise click.BadParameter(value)
    return value