code: def to_json(self, *, indent=None, sort_keys = False):
          return json.dumps({k: v for k, v in dict(self).items() if v is not None}, indent=indent, sort_keys=sort_keys,
                            default=self._try_dict)