translate functions in python