docs: def serialize(self):
          """Convert Document to python dictionary."""
          # Serialize fields to a dict
          elements = []
          for element in self.elements:
              elements.append(element.serialize())
          data = {'type': 'document', 'elements': elements}
          return data