def get_position(fallback=CURSOR_POS_FALLBACK):
values = fallback<EOL>if is_a_tty():<EOL><INDENT>import tty, termios<EOL>try:<EOL><INDENT>with TermStack() as fd:<EOL><INDENT>tty.setcbreak(fd, termios.TCSANOW)      <EOL>sys.stdout.write(CSI + '<STR_LIT>')            <EOL>sys.stdout.flush()<EOL>resp = _read_until(maxchars=<NUM_LIT:10>, end='<STR_LIT:R>')<EOL><DEDENT><DEDENT>except AttributeError:  <EOL><INDENT>return values<EOL><DEDENT>resp = resp.lstrip(CSI)<EOL>try:  <EOL><INDENT>values = tuple( int(token) for token in resp.partition('<STR_LIT:;>')[::-<NUM_LIT:2>] )<EOL><DEDENT>except Exception as err:<EOL><INDENT>log.error('<STR_LIT>', err, resp)<EOL><DEDENT><DEDENT>return values<EOL>
Return the current column number of the terminal cursor.
        Used to figure out if we need to print an extra newline.

        Returns:
            tuple(int): (x, y), (,)  - empty, if an error occurred.

        TODO: needs non-ansi mode for Windows
        Note:
            Checks is_a_tty() first, since function would block if i/o were
            redirected through a pipe.