code: def _dict_contents(self, use_dict=None, as_class=dict):
          
          if _debug: Object._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
  
          # make/extend the dictionary of content
          if use_dict is None:
              use_dict = as_class()
  
          klasses = list(self.__class__.__mro__)
          klasses.reverse()
  
          # build a list of property identifiers "bottom up"
          property_names = []
          properties_seen = set()
          for c in klasses:
              for prop in getattr(c, 'properties', []):
                  if prop.identifier not in properties_seen:
                      property_names.append(prop.identifier)
                      properties_seen.add(prop.identifier)
  
          # extract the values
          for property_name in property_names:
              # get the value
              property_value = self._properties.get(property_name).ReadProperty(self)
              if property_value is None:
                  continue
  
              # if the value has a way to convert it to a dict, use it
              if hasattr(property_value, "dict_contents"):
                  property_value = property_value.dict_contents(as_class=as_class)
  
              # save the value
              use_dict.__setitem__(property_name, property_value)
  
          # return what we built/updated
          return use_dict
docs: Return the contents of an object as a dict.