Generate a sequence of "documents" from the lines in a file

    Arguments:
      path (file or str): path to a file or an open file_obj ready to be read
      mode (str): file mode to open a file in
      strip_eol (bool): whether to strip the EOL char from lines as they are read/generated/yielded
      ascii (bool): whether to use the stringify and to_ascii functions on each line
      eol (str): UNUSED character delimitting lines in the file

    TODO:
      Use `eol` to split lines (currently ignored because use `file.readline` doesn't have EOL arg)

def gen_file_lines(path, mode='rUb', strip_eol=True, ascii=True, eol='\n'):
    """Generate a sequence of "documents" from the lines in a file

    Arguments:
      path (file or str): path to a file or an open file_obj ready to be read
      mode (str): file mode to open a file in
      strip_eol (bool): whether to strip the EOL char from lines as they are read/generated/yielded
      ascii (bool): whether to use the stringify and to_ascii functions on each line
      eol (str): UNUSED character delimitting lines in the file

    TODO:
      Use `eol` to split lines (currently ignored because use `file.readline` doesn't have EOL arg)
    """
    if isinstance(path, str):
        path = open(path, mode)
    with path:
        # TODO: read one char at a time looking for the eol char and yielding the interveening chars
        for line in path:
            if ascii:
                line = str(line)
            if strip_eol:
                line = line.rstrip('\n')
            yield line