'Takes data from the provided object and prepares it for the
resource.'

def dehydrate(self, bundle, for_list=True):

    if (self.attribute is not None):
        current_object = bundle.obj
        for attr in self._attrs:
            previous_object = current_object
            current_object = getattr(current_object, attr, None)
            if (current_object is None):
                if self.null:
                    break
                elif self.has_default():
                    current_object = self._default
                    break
                else:
                    raise ApiFieldError((u"The    object    '%r'    has    an    empty    attribute    '%s'    and    doesn't    allow    a    default    or    null    value." % (previous_object, attr)))
        if callable(current_object):
            current_object = current_object()
        return self.convert(current_object)
    if self.has_default():
        return self.convert(self.default)
    else:
        return None
