code: def serialize(self, *fields):
          
          if fields:
              if not set(fields).issubset(self.data_nodes):
                  raise SchemaError('Invalid field for serialization: {}'.format(set(fields).difference(self.data_nodes)))
  
              return OrderedDict([(k, getattr(self, k)) for k in fields])
  
          return OrderedDict([(k, getattr(self, k)) for k in self.data_nodes])
docs: Serialize Nodes and attributes