Can you rewrite that equation in python code instead of Julia code? And write it as a function.