Root Finding Function Python Code