def _GetCompleteKeyOrError(arg):
 if isinstance(arg, Key):
  key = arg
 elif isinstance(arg, basestring):
  key = Key(arg)
 elif isinstance(arg, Entity):
  key = arg.key()
 elif (not isinstance(arg, Key)):
  raise datastore_errors.BadArgumentError(('Expects argument to be an Entity or Key; received %s (a %s).' % (arg, typename(arg))))
 assert isinstance(key, Key)
 if (not key.has_id_or_name()):
  raise datastore_errors.BadKeyError(('Key %r is not complete.' % key))
 return key

def _GetCompleteKeyOrError ( arg ) : if isinstance ( arg , Key ) : key = arg elif isinstance ( arg , basestring ) : key = Key ( arg ) elif isinstance ( arg , Entity ) : key = arg . key ( ) elif ( not isinstance ( arg , Key ) ) : raise datastore_errors . BadArgumentError ( ( 'Expects argument to be an Entity or Key; received %s (a %s).' % ( arg , typename ( arg ) ) ) ) assert isinstance ( key , Key ) if ( not key . has_id_or_name ( ) ) : raise datastore_errors . BadKeyError ( ( 'Key %r is not complete.' % key ) ) return key
expects an entity or a key .