import gzip


def open_file_helper(filename, compressed, mode="rt"):
    """
    Supports reading of gzip compressed or uncompressed file.

    Parameters:
    ----------
    filename : str
        Name of the file to open.
    compressed : bool
        If true, treat filename as gzip compressed.
    mode : str
        Reading mode.

    Returns:
    --------
    file handle to the opened file.
    """
    return gzip.open(filename, mode=mode) if compressed else open(filename, mode)