def _VerifyProperty(modelclass, attr_name):
  """Return a property if set on a model class, otherwise raises an exception.

  Args:
    modelclass: A subclass of EndpointsModel which has a
        _GetEndpointsProperty method.
    attr_name: String; the name of the property.

  Returns:
    The property set at the attribute name.

  Raises:
    AttributeError: if the property is not set on the class.
  """
  prop = modelclass._GetEndpointsProperty(attr_name)
  if prop is None:
    error_msg = ('The attribute %s is not an accepted field. Accepted fields '
                 'are limited to NDB properties and Endpoints alias '
                 'properties.' % (attr_name,))
    raise AttributeError(error_msg)

  return prop