from typing import List


def _get_list(arg: List[str],from_file: bool) -> List[str]:
    """
    Helper function to handle the from_file = True/False usecases.

    :param arg: either a list of nifti filenames, or a list with a single 
        entry to a textfile (of filenames)
    :param from_file: if False, arg is a list of filenames, if true, it is a 
        list with a single entry to a textfile

    :returns: List of filenames
    """
    if from_file and arg is not None:
        with open(arg[0]) as fh:
           return [x.rstrip('\n') for x in fh] 
    else:
        return arg