def transpose(keysize, bytes_):
    """Transposes a byte sequence into blocks according to a given keysize."""
    blocks = []
    blocksize = len(bytes_) // keysize
    for i in range(keysize):
        block = bytes(bytes_[j] for j in range(i, len(bytes_), keysize))
        blocks.append(block)
    return blocks