code: def unpack(self, string):
          
          if string is None:
              string = CHAR_ZERO * self.__size__
          data = struct.unpack(self.__fmt__, string)
          i = 0
          for field in self.__fields__:
              (vtype, vlen) = self.__fields_types__[field]
              if vtype == 'char': # string
                  setattr(self, field, data[i])
                  i = i + 1
              elif isinstance(vtype, CStructMeta):
                  num = int(vlen / vtype.size)
                  if num == 1: # single struct
                      sub_struct = vtype()
                      sub_struct.unpack(EMPTY_BYTES_STRING.join(data[i:i+sub_struct.size]))
                      setattr(self, field, sub_struct)
                      i = i + sub_struct.size
                  else: # multiple struct
                      sub_structs = []
                      for j in range(0, num):
                          sub_struct = vtype()
                          sub_struct.unpack(EMPTY_BYTES_STRING.join(data[i:i+sub_struct.size]))
                          i = i + sub_struct.size
                          sub_structs.append(sub_struct)
                      setattr(self, field, sub_structs)
              elif vlen == 1:
                  setattr(self, field, data[i])
                  i = i + vlen
              else:
                  setattr(self, field, list(data[i:i+vlen]))
                  i = i + vlen
docs: Unpack the string containing packed C structure data