def ValidateString(value, name='unused', exception=datastore_errors.BadValueError, max_len=_MAX_STRING_LENGTH, empty_ok=False):
 if ((value is None) and empty_ok):
  return
 if ((not isinstance(value, basestring)) or isinstance(value, Blob)):
  raise exception(('%s should be a string; received %s (a %s):' % (name, value, typename(value))))
 if ((not value) and (not empty_ok)):
  raise exception(('%s must not be empty.' % name))
 if (len(value.encode('utf-8')) > max_len):
  raise exception(('%s must be under %d bytes.' % (name, max_len)))

def ValidateString ( value , name = 'unused' , exception = datastore_errors . BadValueError , max_len = _MAX_STRING_LENGTH , empty_ok = False ) : if ( ( value is None ) and empty_ok ) : return if ( ( not isinstance ( value , basestring ) ) or isinstance ( value , Blob ) ) : raise exception ( ( '%s should be a string; received %s (a %s):' % ( name , value , typename ( value ) ) ) ) if ( ( not value ) and ( not empty_ok ) ) : raise exception ( ( '%s must not be empty.' % name ) ) if ( len ( value . encode ( 'utf-8' ) ) > max_len ) : raise exception ( ( '%s must be under %d bytes.' % ( name , max_len ) ) )
raises an exception if value is not a valid string or a subclass thereof .