def get_attribute(self, instance, *args, **kwargs):
    'Return the whole instance, instead of looking up an attribute value.\n\n        Implementation note: We do this because `Serializer.to_representation`\n        builds the list of serializer fields with something like:\n\n            for field in serializer_fields:\n              field.to_representation(field.get_attribute(instance))\n\n        Since we need the instance in `to_representation` so we can query arbitrary\n        attributes on it to build urls, we simply have to return the instance here.\n        '
    return instance
Return the whole instance, instead of looking up an attribute value.

Implementation note: We do this because `Serializer.to_representation`
builds the list of serializer fields with something like:

    for field in serializer_fields:
      field.to_representation(field.get_attribute(instance))

Since we need the instance in `to_representation` so we can query arbitrary
attributes on it to build urls, we simply have to return the instance here.
def get_attribute(self, instance, *args, **kwargs):
    'Return the whole instance, instead of looking up an attribute value.\n\n        Implementation note: We do this because `Serializer.to_representation`\n        builds the list of serializer fields with something like:\n\n            for field in serializer_fields:\n              field.to_representation(field.get_attribute(instance))\n\n        Since we need the instance in `to_representation` so we can query arbitrary\n        attributes on it to build urls, we simply have to return the instance here.\n        '
    return instance