def METHOD_NAME(params, name, values):
    value = _get_required(params, name)
    if value not in values:
        raise ValueError("Invalid value %r for %r, expecting one of %s" %
                         (value, name, values))
    return value