def wait_key(keys=None):
if is_a_tty():<EOL><INDENT>if keys:<EOL><INDENT>if not isinstance(keys, tuple):<EOL><INDENT>keys = (keys,)<EOL><DEDENT>while True:<EOL><INDENT>key = _getch()<EOL>if key in keys:<EOL><INDENT>return key<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>return _getch()<EOL><DEDENT><DEDENT>
Waits for a keypress at the console and returns it.
        "Where's the any key?"

        Arguments:
            keys - if passed, wait for this specific key, e.g. ESC.
                   may be a tuple.
        Returns:
            char or ESC - depending on key hit.
            None - immediately under i/o redirection, not an interactive tty.