code: def serialize_hook(instance):
      
  
      if getattr(instance, 'serialize_hook', None) and callable(instance.serialize_hook):
          return instance.serialize_hook(hook=instance)
      if getattr(settings, 'HOOK_SERIALIZER', None):
          serializer = get_module(settings.HOOK_SERIALIZER)
          return serializer(instance, hook=instance)
      # if no user defined serializers, fallback to the django builtin!
      return {
          'hook': instance.dict(),
          'data': serializers.serialize('python', [instance])[0]
      }
docs: Serialize the object down to Python primitives.
  
      By default it uses Django's built in serializer.