def _coerce_to_key(value):
 if (value is None):
  return None
 (value, multiple) = datastore.NormalizeAndTypeCheck(value, (Model, Key, basestring))
 if (len(value) > 1):
  raise datastore_errors.BadArgumentError('Expected only one model or key')
 value = value[0]
 if isinstance(value, Model):
  return value.key()
 elif isinstance(value, basestring):
  return Key(value)
 else:
  return value

def _coerce_to_key ( value ) : if ( value is None ) : return None ( value , multiple ) = datastore . NormalizeAndTypeCheck ( value , ( Model , Key , basestring ) ) if ( len ( value ) > 1 ) : raise datastore_errors . BadArgumentError ( 'Expected only one model or key' ) value = value [ 0 ] if isinstance ( value , Model ) : return value . key ( ) elif isinstance ( value , basestring ) : return Key ( value ) else : return value
returns the values key .