def NormalizeAndTypeCheck(arg, types):
 if (not isinstance(types, (list, tuple))):
  types = (types,)
 assert ((list not in types) and (tuple not in types))
 if isinstance(arg, types):
  return ([arg], False)
 else:
  if isinstance(arg, basestring):
   raise datastore_errors.BadArgumentError(('Expected an instance or iterable of %s; received %s (a %s).' % (types, arg, typename(arg))))
  try:
   arg_list = list(arg)
  except TypeError:
   raise datastore_errors.BadArgumentError(('Expected an instance or iterable of %s; received %s (a %s).' % (types, arg, typename(arg))))
  for val in arg_list:
   if (not isinstance(val, types)):
    raise datastore_errors.BadArgumentError(('Expected one of %s; received %s (a %s).' % (types, val, typename(val))))
  return (arg_list, True)

def NormalizeAndTypeCheck ( arg , types ) : if ( not isinstance ( types , ( list , tuple ) ) ) : types = ( types , ) assert ( ( list not in types ) and ( tuple not in types ) ) if isinstance ( arg , types ) : return ( [ arg ] , False ) else : if isinstance ( arg , basestring ) : raise datastore_errors . BadArgumentError ( ( 'Expected an instance or iterable of %s; received %s (a %s).' % ( types , arg , typename ( arg ) ) ) ) try : arg_list = list ( arg ) except TypeError : raise datastore_errors . BadArgumentError ( ( 'Expected an instance or iterable of %s; received %s (a %s).' % ( types , arg , typename ( arg ) ) ) ) for val in arg_list : if ( not isinstance ( val , types ) ) : raise datastore_errors . BadArgumentError ( ( 'Expected one of %s; received %s (a %s).' % ( types , val , typename ( val ) ) ) ) return ( arg_list , True )
normalizes and type checks the given argument .