code: def root_serializer(self):
          
          if not self.parent:
              # Don't cache, so that we'd recompute if parent is set.
              return None
  
          node = self
          seen = set()
          while True:
              seen.add(node)
              if getattr(node, 'parent', None):
                  node = node.parent
                  if node in seen:
                      return None
              else:
                  return node
docs: Return the root serializer (serializer for the primary resource).