def _normalize_key(value):
 if getattr(value, 'key', None):
  return value.key()
 elif isinstance(value, basestring):
  return datastore.Key(value)
 else:
  return value

def _normalize_key ( value ) : if getattr ( value , 'key' , None ) : return value . key ( ) elif isinstance ( value , basestring ) : return datastore . Key ( value ) else : return value
return a key from an entity .