code: def asdict(self):
          
          result = {}
          for key in self._fields:
              value = getattr(self, key)
              if isinstance(value, list):
                  value = [i.asdict() if isinstance(i, Resource) else i for i in value]
              if isinstance(value, Resource):
                  value = value.asdict()
              result[key] = value
          return result
docs: Convert resource to dictionary