'Construct the no_dereference context manager.
:param cls: the class to turn dereferencing off on'

def __init__(self, cls):

    self.cls = cls
    ReferenceField = _import_class('ReferenceField')
    GenericReferenceField = _import_class('GenericReferenceField')
    ComplexBaseField = _import_class('ComplexBaseField')
    self.deref_fields = [k for (k, v) in self.cls._fields.iteritems() if isinstance(v, (ReferenceField, GenericReferenceField, ComplexBaseField))]
