def validated_parameter(args, name, values=None, default=None, case_sensitive=False):
 param = args.get(name)
 if param:
  param = param.lower()
 else:
  param = default
 if (not values):
  return param
 else:
  if (values and (param not in values)):
   list_str = ', '.join(values)
   raise RequestError(("Parameter '%s' should be one of: %s" % (name, list_str)))
  return param

def validated_parameter ( args , name , values = None , default = None , case_sensitive = False ) : param = args . get ( name ) if param : param = param . lower ( ) else : param = default if ( not values ) : return param else : if ( values and ( param not in values ) ) : list_str = ', ' . join ( values ) raise RequestError ( ( "Parameter '%s' should be one of: %s" % ( name , list_str ) ) ) return param
return validated parameter param that has to be from the list of values if provided .