def FromValue(prop, value):
  if value is None:
    return value

  if isinstance(prop, (ndb.StructuredProperty, ndb.LocalStructuredProperty)):
    modelclass = prop._modelclass
    if not utils.IsSubclass(modelclass, EndpointsModel):
      error_msg = ('Structured properties should refer to models which '
                   'inherit from EndpointsModel. Received an instance '
                   'of %s.' % (modelclass.__class__.__name__,))
      raise TypeError(error_msg)
    return modelclass.FromMessage(value)

  if hasattr(prop, 'FromValue') and callable(prop.FromValue):
    return prop.FromValue(value)
  elif isinstance(prop, ndb.UserProperty):
    return utils.UserMessageToUser(value)
  elif isinstance(prop, ndb.GeoPtProperty):
    return datastore_types.GeoPt(lat=value.lat, lon=value.lon)
  elif isinstance(prop, ndb.KeyProperty):
    return ndb.Key(urlsafe=value)
  elif isinstance(prop, ndb.BlobKeyProperty):
    return datastore_types.BlobKey(value)
  elif isinstance(prop, (ndb.TimeProperty,
                         ndb.DateProperty,
                         ndb.DateTimeProperty)):
    return utils.DatetimeValueFromString(value)
  else:
    return value
Returns true if the current token is a function block open.
dataset/ETHPy150Open GoogleDeveloperExperts/experts-app-backend/endpoints_proto_datastore/ndb/model.py/FromValue--crossover with--dataset/ETHPy150Open google/closure-linter/closure_linter/statetracker.py/StateTracker.IsFunctionOpen