There is no general way of converting Python code to C/C++/Fortran. In general
these languages are quite different and a direct translation is not possible.
You may use sympy to generate C code for simple expressions.
Cython, F2PY, SWIG etc are various kinds of tools for mixing these languages.
FEniCS generates C++ code based on a domain-specific language (UFL)
implemented in Python.