def semicolon(self, stmt): if not isinstance(stmt, _ast.If) and not isinstance(stmt, _ast.While) and not isinstance(stmt, _ast.For): return ";" else: return ""