'Dumps all attributes to a dictionary'

def dump_attrs(self):

    attrs = dict()
    for (name, attribute) in iteritems(self._valid_attrs):
        attr = getattr(self, name)
        if ((attribute.isa == 'class') and (attr is not None) and hasattr(attr, 'serialize')):
            attrs[name] = attr.serialize()
        else:
            attrs[name] = attr
    return attrs
