code: def to_dict(self):
          
          return {k: getattr(self, k) for k in filter(
              lambda k: not k.startswith('_') and k != 'to_dict', dir(self))}
docs: Convert attributes and properties to a dict,
          so that it can be serialized.