[1.7.x] Fixed #23296 -- Fixed RunPython code sample in Migration Operations.

Backport of 7ca665c5f5 from master