def unwrap(self, value, fields=None, session=None):
''' If ``autoload`` is False, return a DBRef object. Otherwise load
the object.
'''
self.validate_unwrap(value)
value.type = self.type
return value