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)

        # 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:
                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

#
#   SequenceOf
#
Return the contents of an object as a dict.
dataset/ETHPy150Open JoelBender/bacpypes/py27/bacpypes/constructeddata.py/Sequence.dict_contents