code: def serialize(self, null_values=False):
      
      ret = {}
      property_dict = dict(self.__class__.__dict__)  # contain view definition defaults
      property_dict.update(self.__dict__)  # overrides done at runtime
  
      for k in property_dict.keys():
        if k[:1] == "_" or (property_dict[k] is None and not null_values):
          continue
  
        v = property_dict[k]
  
        if isinstance(v, list):
          v_items = []
          for v_item in v:
            if self._isclass(v_item.__class__, BaseView):
              v_item_val = v_item.serialize(null_values=null_values)
              if not null_values and len(v_item_val) == 0:
                continue
              v_items.append(v_item_val)
            elif self._isclass(v_item, BaseView):  # when were passed Class instead of instance
              pass
            else:
              v_items.append(v_item)
  
          ret[k] = v_items
        elif self._isclass(v.__class__, BaseView):
          ret[k] = v.serialize(null_values=null_values)
        elif self._isclass(v, BaseView):  # when were passed Class instead of instance
          pass
        else:
          ret[k] = v
  
      return ret
docs: :type null_values bool
      :rtype: dict