try and exception handling in python