nit: not a global variable, no capitables
devnull = open(os.devnull, 'wb')
or even fd_null = open(os.devnull, 'wb')