def get_validated_options(options, warn=True):
 validated_options = {}
 for (opt, value) in iteritems(options):
  lower = opt.lower()
  try:
   validator = URI_VALIDATORS.get(lower, raise_config_error)
   value = validator(opt, value)
  except (ValueError, ConfigurationError) as exc:
   if warn:
    warnings.warn(str(exc))
   else:
    raise
  else:
   validated_options[lower] = value
 return validated_options

def get_validated_options ( options , warn = True ) : validated_options = { } for ( opt , value ) in iteritems ( options ) : lower = opt . lower ( ) try : validator = URI_VALIDATORS . get ( lower , raise_config_error ) value = validator ( opt , value ) except ( ValueError , ConfigurationError ) as exc : if warn : warnings . warn ( str ( exc ) ) else : raise else : validated_options [ lower ] = value return validated_options
validate each entry in options and raise a warning if it is not valid .