code: def to_dict(self, skip_nulls=True):
          
          self._validate()
          out = {}
          for k in self._get_params():
              val = getattr(self, k)
              if not skip_nulls or val is not None:
                  out[k] = _convert(val, 'to_dict', skip_nulls)
          return out
docs: Convert object to a dict