def upper_lower_none(arg):
    """Validate arg value as "upper", "lower", or None."""
    if not arg:
        return arg

    arg = arg.strip().lower()
    if arg in ["upper", "lower"]:
        return arg

    raise ValueError('argument must be "upper", "lower" or None')