Writing a function called open_file(). The program will try to open a file. An error message should be shown if the file cannot be opened : I need to define a function called open_file(prompt_str): This function receives a string which is the message to
diplay when prompting the user to enter a filename. The program will try to open a file.
An error message should be shown if the file cannot be opened. This function will loop
until it receives proper input and successfully opens the file. It returns a file pointer.
fp = open(filename, "r ")

for this hw assignment i was given the already defined variable "Option"

    OPTION = "\nMenu\
\n\t1: Display data by year\
\n\t2: Display data by country\
\n\t3: Display country codes\
\n\t4: Stop the Program\
\n\n\tEnter option number: "

"Enter the filename to read: "
"File not found! Try Again!"
"Enter year: "
"Year needs to be between 2009 and 2017. Try Again!"
"Do you want to plot (yes/no)? "
"Enter country code: "
"Country code is not found! Try Again!"
"\nCountry Code Reference"
"Invalid option. Try Again!"
"\nThanks for using this program!"

import matplotlib.pyplot as plt
import csv
from operator import itemgetter

MIN_YEAR = 2009
MAX_YEAR = 2017

def open_file(prompt_str):
    '''
        WRITE DOCSTRING HERE!!!
    '''
    filename = input(Option)
    #Do i use a if statment or try except or while to check whether file is able to be opened 
    fp = open(filename, "r ", encoding = "utf-8 ")