def read_rar(apath, fname, encoding='utf-8', errors='ignore', process_line=None
    ):
    """Read lines from a file in rar archive.

    :param fname: a name of the file in the archive
    :param process_line: a function that will be invoked to process each file's
                         line. If its result is a list, then it will be
                         returned by lines
    :type process_line: callable
    """
    from rarfile import RarFile
    with RarFile(apath) as a:
        with a.open(fname) as f:
            for line in f:
                line = line.decode(encoding=encoding, errors=errors)
                if process_line:
                    line = process_line(line)
                    if isinstance(line, list):
                        for line_ in line:
                            yield line_
                        continue
                yield line
