[python mode] Fix indentation-breaking bug

Issue #2503