from typing import Union
from typing import List
import pathlib


def read_list(fn: Union[List, str, pathlib.Path]) -> List:
    """
    Read file and output list, or take list and output list.

    Parameters
    ----------
    fn : Union[[list, str, pathlib.Path]]
        Input text file or list

    Returns
    -------
    list
    """
    if isinstance(fn, (pathlib.Path, str)):
        with open(fn) as f:
            filter_fns = f.readlines()
        return [_.strip() for _ in filter_fns if not _.startswith("#")]
    return fn