first transcription a python-like-sql into python code