def fn():
        try:
            fd = sys.stdin.fileno()
            old_settings = termios.tcgetattr(fd)
            tty.setraw(fd)
            ch = sys.stdin.read(1)
        except:
            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
            raise Exception
        termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
        return ch