Python code: organize