code: def to_json(self):
          
          a_per = self.analysis_period.to_json() if self.analysis_period else None
          return {'data_type': self.data_type.to_json(),
                  'unit': self.unit,
                  'analysis_period': a_per,
                  'metadata': self.metadata}
docs: Return a header as a dictionary.