code: def as_dict(self):
          
          result = {}
          for key in self._valid_properties:
              val = getattr(self, key)
              if isinstance(val, datetime):
                  val = val.isoformat()
              # Parse custom classes
              elif val and not Model._is_builtin(val):
                  val = val.as_dict()
              # Parse lists of objects
              elif isinstance(val, list):
                  # We only want to call as_dict in the case where the item
                  # isn't a builtin type.
                  for i in range(len(val)):
                      if Model._is_builtin(val[i]):
                          continue
                      val[i] = val[i].as_dict()
              # If it's a boolean, add it regardless of the value
              elif isinstance(val, bool):
                  result[key] = val
  
              # Add it if it's not None
              if val:
                  result[key] = val
          return result
docs: Returns a dict representation of the resource