def as_dict(self):
        try:
            property_storage = self.property_set_storage.Open(self.fmtid, STGM.READ | STGM.SHARE_EXCLUSIVE)
        except pythoncom.com_error:
            error = sys.exc_info()[1]
            if error.strerror == 'STG_E_FILENOTFOUND':
                return {}
            else:
                raise

        properties = {}
        for name, property_id, vartype in property_storage:
            if name is None:
                property_names = PROPERTIES.get(self.fmtid, constants.Constants())
                name = property_names.name_from_value(property_id, unicode(hex(property_id)))
            try:
                for value in property_storage.ReadMultiple([property_id]):
                    properties[name] = value
            #
            # There are certain values we can't read; they
            # raise type errors from within the pythoncom
            # implementation, thumbnail
            #
            except __HOLE__:
                properties[name] = None
        return properties
dataset/ETHPy150Open tjguk/winsys/winsys/shell.py/PropertySet.as_dict