Decode a frame with the help of the table.

def _decode(frame, tab):
        """Decode a frame with the help of the table."""

        blocks = []

        # Decode each block
        while frame:
            length, endseq = tab[frame[0]]
            blocks.extend([frame[1:length], endseq])
            frame = frame[length:]

        # Remove one (and only one) trailing '\0' as necessary
        if blocks and len(blocks[-1]) > 0:
            blocks[-1] = blocks[-1][:-1]

        # Return the decoded plaintext
        return ''.join(blocks)