Root Finding Algorithm Python Template Pattern