def _read_group_field(self, group, levels, field_type, field_size,  
                          decrypted_content):
        """This method handles the different fields of a group"""

        if field_type == 0x0000:
            # Ignored (commentar block)
            pass
        elif field_type == 0x0001:
            group.id_ = struct.unpack('<I', decrypted_content[:4])[0]
        elif field_type == 0x0002:
            try:
                group.title = struct.unpack('<{0}s'.format(field_size-1),
                    decrypted_content[:field_size-1])[0].decode('utf-8')
            except UnicodeDecodeError:
                group.title = struct.unpack('<{0}s'.format(field_size-1),
                    decrypted_content[:field_size-1])[0].decode('latin-1')
            decrypted_content = decrypted_content[1:]
        elif field_type == 0x0003:
            group.creation = self._get_date(decrypted_content)
        elif field_type == 0x0004:
            group.last_mod = self._get_date(decrypted_content)
        elif field_type == 0x0005:
            group.last_access = self._get_date(decrypted_content)
        elif field_type == 0x0006:
            group.expire = self._get_date(decrypted_content)
        elif field_type == 0x0007:
            group.image = struct.unpack('<I', decrypted_content[:4])[0]
        elif field_type == 0x0008:
            level = struct.unpack('<H', decrypted_content[:2])[0]
            group.level = level
            levels.append(level)
        elif field_type == 0x0009:
            group.flags = struct.unpack('<I', decrypted_content[:4])[0]
        elif field_type == 0xFFFF:
            pass
        else:
            return False
        return True
def _read_group_field ( self , group , levels , field_type , field_size , decrypted_content ) : if field_type == 0x0000 : pass elif field_type == 0x0001 : group . id_ = struct . unpack ( '<I' , decrypted_content [ : 4 ] ) [ 0 ] elif field_type == 0x0002 : try : group . title = struct . unpack ( '<{0}s' . format ( field_size - 1 ) , decrypted_content [ : field_size - 1 ] ) [ 0 ] . decode ( 'utf-8' ) except UnicodeDecodeError : group . title = struct . unpack ( '<{0}s' . format ( field_size - 1 ) , decrypted_content [ : field_size - 1 ] ) [ 0 ] . decode ( 'latin-1' ) decrypted_content = decrypted_content [ 1 : ] elif field_type == 0x0003 : group . creation = self . _get_date ( decrypted_content ) elif field_type == 0x0004 : group . last_mod = self . _get_date ( decrypted_content ) elif field_type == 0x0005 : group . last_access = self . _get_date ( decrypted_content ) elif field_type == 0x0006 : group . expire = self . _get_date ( decrypted_content ) elif field_type == 0x0007 : group . image = struct . unpack ( '<I' , decrypted_content [ : 4 ] ) [ 0 ] elif field_type == 0x0008 : level = struct . unpack ( '<H' , decrypted_content [ : 2 ] ) [ 0 ] group . level = level levels . append ( level ) elif field_type == 0x0009 : group . flags = struct . unpack ( '<I' , decrypted_content [ : 4 ] ) [ 0 ] elif field_type == 0xFFFF : pass else : return False return True
This method handles the different fields of a group