code: def dict_contents(self, use_dict=None, as_class=dict):
          
          if _debug: Sequence._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
          global _sequence_of_classes, _list_of_classes
  
          # make/extend the dictionary of content
          if use_dict is None:
              use_dict = as_class()
  
          # loop through the elements
          for element in self.sequenceElements:
              value = getattr(self, element.name, None)
              if value is None:
                  continue
  
              if (element.klass in _sequence_of_classes) or (element.klass in _list_of_classes):
                  helper = element.klass(value)
                  mapped_value = helper.dict_contents(as_class=as_class)
  
              elif issubclass(element.klass, Atomic):
                  mapped_value = value                        ### ambiguous
  
              elif issubclass(element.klass, AnyAtomic):
                  mapped_value = value.value                  ### ambiguous
  
              elif isinstance(value, element.klass):
                  mapped_value = value.dict_contents(as_class=as_class)
                  use_dict.__setitem__(element.name, mapped_value)
  
              else:
                  continue
  
              # update the dictionary being built
              use_dict.__setitem__(element.name, mapped_value)
  
          # return what we built/updated
          return use_dict
docs: Return the contents of an object as a dict.