'Get reference object.
This method will fetch unresolved entities from the datastore if
they are not already loaded.
Returns:
ReferenceProperty to Model object if property is set, else None.
Raises:
ReferencePropertyResolveError: if the referenced model does not exist.'

def __get__(self, model_instance, model_class):

    if (model_instance is None):
        return self
    if hasattr(model_instance, self.__id_attr_name()):
        reference_id = getattr(model_instance, self.__id_attr_name())
    else:
        reference_id = None
    if (reference_id is not None):
        resolved = getattr(model_instance, self.__resolved_attr_name())
        if (resolved is not None):
            return resolved
        else:
            instance = get(reference_id)
            if (instance is None):
                raise ReferencePropertyResolveError(('ReferenceProperty    failed    to    be    resolved:    %s' % reference_id.to_path()))
            setattr(model_instance, self.__resolved_attr_name(), instance)
            return instance
    else:
        return None
