code: def get_canonical_serializer(
          resource_key,
          model=None,
          instance=None,
          resource_name=None
      ):
          
  
          if model:
              resource_key = get_model_table(model)
          elif instance:
              resource_key = instance._meta.db_table
          elif resource_name:
              resource_key = resource_name_map[resource_name]
  
          if resource_key not in resource_map:
              return None
  
          return resource_map[resource_key]['viewset'].serializer_class
docs: Return canonical serializer for a given resource name.
  
          Arguments:
              resource_key - Resource key, usually DB table for model-based
                             resources, otherwise the plural name.
              model - (Optional) Model class to look up by.
              instance - (Optional) Model object instance.
          Returns: serializer class