code: def key_value_contents(use_dict=None, as_class=dict, key_values=()):
      
      if _debug: key_value_contents._debug("key_value_contents use_dict=%r as_class=%r key_values=%r", use_dict, as_class, key_values)
  
      # make/extend the dictionary of content
      if use_dict is None:
          use_dict = as_class()
  
      # loop through the values and save them
      for k, v in key_values:
          if v is not None:
              if hasattr(v, 'dict_contents'):
                  v = v.dict_contents(as_class=as_class)
              use_dict.__setitem__(k, v)
  
      # return what we built/updated
      return use_dict
docs: Return the contents of an object as a dict.