def hotpatch_oswrite(conn):
 conn.execute(textwrap.dedent('\n    import sys\n    import os\n    def patched_write(fd, s):\n        if fd==1:\n            return sys.stdout.write(s)\n        elif fd==2:\n            return sys.stdout.write(s)\n        else:\n            return os.write(fd, s)\n    os.write=patched_write\n    '))

def hotpatch_oswrite ( conn ) : conn . execute ( textwrap . dedent ( '\n    import sys\n    import os\n    def patched_write(fd, s):\n        if fd==1:\n            return sys.stdout.write(s)\n        elif fd==2:\n            return sys.stdout.write(s)\n        else:\n            return os.write(fd, s)\n    os.write=patched_write\n    ' ) )
some scripts/libraries use os .