def file_as_blockiter(file, block_size=65536):
    """
    Treat a file handler as block generator of bytes
    :param typing.FileIO[bytes] file: The file object
    :param int block_size: The size of each block
    :return: A generator that can be used to iterate block chunks
    """
    block = file.read(block_size)
    while len(block) > 0:
        yield block
        block = file.read(block_size)
