-use python
-please read instruction
only need three functions
- def main
-def checkfile
try/except block for this one
-def check integer
try/except block for this one also
#instructions
output is below
the user to open, read, write, and add on to f Your job is to program an interface that allows All of the files should contain integer values. There should be a menu that the user loops through until they decide to ext the program You should use the following functions (required) checkfile o Parameter filename o Return value: valid file or a flag for invalid files o Purpose: Should determine whether a file is valid (exists) or not. Ifit is, return the opened file. If it's not, return a flag the main function can use o Parameter. value o Return value: valid number or a flag for invalid int . checkint - o Purpose: Should determine whether a number is invalid or not If it is, return the valid integer. If it's not, return a flag the main function can use emain - Parameter none o Return value: none o Purpose: Display the menu and loop until the user is done. Get any inputs from the users and display any needed outputs. Your checkFile and checkint functions should not have any input/output. Your program should also utilize try/except blocks. It should not crash based on a file not existing/incorrect values being passed to an int conversion Your menu should contain/handle .Exit option . Read file if it is, it should Gets a file from the user and validates that it's an existing file print the entire contents (without any extra whitespace) .Write to a file Your checkFile and checkint functions should not have any inputloutput. Your program should also utilize try/lexcept blocks. It should not crash based on a file not existinglincorrect values being passed to an int conversion Your menu should contain/handle: . Exit option - Read file Gets a file from the user and validates that it's an existing file. If it is, it should print the entire contents (without any extra whitespace) . Write to a file - Gets a file from the user. Loops-while the user wants to cont nue entering irn numbers, it should validate that the number is an integer. If it is, it should write to the file; if it's not, it should display an error message Append to a file . : Gets a file from the user. Loops while the user wants to continue entering in numbers, it should validate that each number is an integer. If it is, it should write to the file, if its not, it should display an error message Invalid option error Sample Execution: Hello! Welcome to the file processor. Selection Menu: 0. Exit Program 1. Read from a file 2. Write integers to a file. 3. Append integers to a file. which would you like to do? 1 Please enter in a file name: hello sorry, that wasn't a valid file, Please try again Selection Menu: 0. Exit Program 1, Read from a file 2. Write integers to a file. 3. Append integers to a file. which would you like to do? 2 Enter the file you'd like to write to: numtest.txt Enter in numbers. Type "done" when you no longer wish to. Enter in a nunber: 1 Enter in a number: 1:0 That's not an integer! Please try again. Enter in a number: 2 Enter in a number: done selection Menu: 0. Exit Program 1. Read fro Which would you like to do? 2 Enter the file you'd like to write to: numtest.txt Enter in numbers. Type "done" when you no longer wish to. Enter in a number: 1 Enter in a number: 1.0 That's not an integer! Please try again. Enter in a number: 2 Enter in a number: done Selection Menu: 0. Exit Program 1. Read from a file 2. Write integers to a file. 3. Append integers to a file Which would you like to do? 1 Please enter in a file name: numtest.txt Reading... The file you entered in contains: Selection Menu: 0. Exit Program 1. Read from a file 2. Write integers to a file 3. Append integers to a file which would you like to do