import string
import click


def validate_bigip_name(ctx, param, value):
    """
    Big-IP is kinda picky about names. Names with special characters
    will (mostly) get rejected, and some (slashes) will lead to unexpected
    results (path traversal). Best not to accept names like that.
    """
    if not value:
        return None

    allowed_characters = string.ascii_letters + string.digits + "._-"

    for char in value:
        if char not in allowed_characters:
            raise click.BadParameter("The requested object name is invalid")
    return value