statement to catch the error what happens if you change oops to raise keyerror instead of an indexerrorwhere do the names keyerror and indexerror come from(hintrecall that all unqualified names generally come from one of four scopes exception objects and lists change the oops function you just wrote to raise an exception you define yourselfcalled myerror identify your exception with class (unless you're using python or earlieryou mustthenextend the try statement in the catcher function to catch this exception and its instance in addition to indexerrorand print the instance you catch error handling write function called safe(func*pargs**kargsthat runs any function with any number of positional and/or keyword arguments by using the arbitrary arguments header and call syntaxcatches any exception raised while the function runsand prints the exception using the exc_info call in the sys module then use your safe function to run your oops function from exercise or put safe in module file called exctools pyand pass it the oops function interactively what kind of error messages do you getfinallyexpand safe to also print python stack trace when an error occurs by calling the built-in print_exc function in the standard traceback modulesee earlier in this and consult the python library reference manual for usage details we could probably code safe as function decorator using techniquesbut we'll have to move on to the next part of the book to learn fully how (see the solutions for preview self-study examples at the end of appendix di've included handful of example scripts developed as group exercises in live python classes for you to study and run on your own in conjunction with python' standard manual set these are not describedand they use tools in the python standard library that you'll have to research on your own stillfor many readersit helps to see how the concepts we've discussed in this book come together in real programs if these whet your appetite for moreyou can find wealth of larger and more realistic applicationlevel python program examples in follow-up books like programming python and on the web designing with exceptions