def get_allowed_params(params, whitelist):
 allowed_params = {}
 for (key, get_type) in six.iteritems(whitelist):
  assert (get_type in PARAM_TYPES)
  value = None
  if (get_type == PARAM_TYPE_SINGLE):
   value = params.get(key)
  elif (get_type == PARAM_TYPE_MULTI):
   value = params.getall(key)
  elif (get_type == PARAM_TYPE_MIXED):
   value = params.getall(key)
   if (isinstance(value, list) and (len(value) == 1)):
    value = value.pop()
  if value:
   allowed_params[key] = value
 return allowed_params

def get_allowed_params ( params , whitelist ) : allowed_params = { } for ( key , get_type ) in six . iteritems ( whitelist ) : assert ( get_type in PARAM_TYPES ) value = None if ( get_type == PARAM_TYPE_SINGLE ) : value = params . get ( key ) elif ( get_type == PARAM_TYPE_MULTI ) : value = params . getall ( key ) elif ( get_type == PARAM_TYPE_MIXED ) : value = params . getall ( key ) if ( isinstance ( value , list ) and ( len ( value ) == 1 ) ) : value = value . pop ( ) if value : allowed_params [ key ] = value return allowed_params
extract from params all entries listed in whitelist .