def __decode_struct(self, filename):
        stat = {}
        T = None
        MagicDecoderRing = self.mapProcFiles[filename] 
        try:
            statusFile = open(self.path+'/'+filename)
            for i in _range(0,len(MagicDecoderRing['T'])):
                size_t = struct.calcsize(MagicDecoderRing['T'][i])
                T = struct.unpack(MagicDecoderRing['T'][i],statusFile.read(size_t))
                #None represents padding and should be skipped 
                if MagicDecoderRing[i] is not None:
                    #items with one to one attributes
                    if len(T) == len(MagicDecoderRing[i]):
                        for x in _range(0,len(T)):
                            stat[MagicDecoderRing[i][x]] = T[x]
                    #timestruc_t items below here
                    elif type(T[0]) is int:  
                        stat[MagicDecoderRing[i]] = self._nanosec2dec(T)
                    #must be a string ... err character array
                    elif type(T[0]) is str:
                        #worst list comprehension ever!!!!
                        stat[MagicDecoderRing[i]] = \
                                [b for b in ' '.join([a for a in \
                                ''.join(list(T)).split('\x00') \
                                if a != '']).split(' ') if b != ''] 
            statusFile.close()
        except: pass
        return stat
I hate this method!!!
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/kitt/proc/SunOS.py/_SunProc.__decode_struct