def validate_options(options):
 if (not options):
  return
 for (k, v) in options.iteritems():
  if (not isinstance(k, str)):
   raise TypeError(('option %r should be a str.' % k))
  if (not any((k.lower().startswith(valid) for valid in _GCS_OPTIONS))):
   raise ValueError(('option %s is not supported.' % k))
  if (not isinstance(v, basestring)):
   raise TypeError(('value %r for option %s should be of type basestring.' % (v, k)))

def validate_options ( options ) : if ( not options ) : return for ( k , v ) in options . iteritems ( ) : if ( not isinstance ( k , str ) ) : raise TypeError ( ( 'option %r should be a str.' % k ) ) if ( not any ( ( k . lower ( ) . startswith ( valid ) for valid in _GCS_OPTIONS ) ) ) : raise ValueError ( ( 'option %s is not supported.' % k ) ) if ( not isinstance ( v , basestring ) ) : raise TypeError ( ( 'value %r for option %s should be of type basestring.' % ( v , k ) ) )
validates and normalizes options passed in a mongodb uri .