BGE Logic blocks to python script?

Does anyone know, if there’s a way to export BGE logic blocks to python .py
It would be useful.