def _seek_delimiter(file, delimiter, blocksize=2 ** 16):
    """ Seek current file to next byte after a delimiter
        from https://github.com/dask/hdfs3/blob/master/hdfs3/utils.py#L11

        Parameters
        ----------
        file: a file
        delimiter: bytes
            a delimiter like b'
'
        blocksize: int
            number of bytes to read
        """
    last = b''
    while True:
        current = file.read(blocksize)
        if not current:
            return
        full = last + current
        try:
            i = full.index(delimiter)
            file.seek(file.tell() - (len(full) - i) + len(delimiter))
            return
        except ValueError:
            pass
        last = full[-len(delimiter):]
