def get_input_file(prompt):
    """Prompt the user for a filename and
    return a corresponding open text file.
    """
    infile = None
    while infile == None:
        filename = input(prompt)
        try:
            infile = open(filename, "rt")
        except (FileNotFoundError, PermissionError) as error:
            print(error)
            print("Please choose a different file.")
    print()
    return infile