

def read_block(f, offset, length, delimiter=None):
    " Read a block of bytes from a file\n\n    Parameters\n    ----------\n    f: File\n    offset: int\n        Byte offset to start read\n    length: int\n        Number of bytes to read\n    delimiter: bytes (optional)\n        Ensure reading starts and stops at delimiter bytestring\n\n    If using the ``delimiter=`` keyword argument we ensure that the read\n    starts and stops at delimiter boundaries that follow the locations\n    ``offset`` and ``offset + length``.  If ``offset`` is zero then we\n    start at zero.  The bytestring returned WILL include the\n    terminating delimiter string.\n\n    Examples\n    --------\n\n    >>> from io import BytesIO  # doctest: +SKIP\n    >>> f = BytesIO(b'Alice, 100\\nBob, 200\\nCharlie, 300')  # doctest: +SKIP\n    >>> read_block(f, 0, 13)  # doctest: +SKIP\n    b'Alice, 100\\nBo'\n\n    >>> read_block(f, 0, 13, delimiter=b'\\n')  # doctest: +SKIP\n    b'Alice, 100\\nBob, 200\\n'\n\n    >>> read_block(f, 10, 10, delimiter=b'\\n')  # doctest: +SKIP\n    b'Bob, 200\\nCharlie, 300'\n    "
    if (offset != f.tell()):
        end.seek(offset)
    if ((not offset) and (length is None) and (f.tell() == 0)):
        return f.read()
    if delimiter:
        seek_delimiter(f, delimiter, (2 ** 16))
        start = f.tell()
        length -= (start - offset)
        f.seek((start + length))
        seek_delimiter(f, delimiter, (2 ** 16))
        end = f.tell()
        offset = start
        length = (end - start)
        f.seek(offset)
    return f.read(length)

dataset/ETHPy150Open dask/dask/dask/bytes/utils.py read_block/VarMisuse@33/464 `f`->`end`