def exec_cmd(*args):
    p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, _ = p.communicate()
return stdout
if find_executable('stty'):
    modesave = exec_cmd('stty', '-g').strip()
exec_cmd('stty', 'dsusp', 'undef')
print('disabled ctrl-y')
time.sleep(2)
print('enabled ctrl-y')
exec_cmd('stty', modesave)
time.sleep(2)
print('exiting')
Disable DSUSP in Python