Returns current position of cursor, starts at 1.

def get_position(stream=STD_OUTPUT_HANDLE):
    ''' Returns current position of cursor, starts at 1. '''
    stream = kernel32.GetStdHandle(stream)
    csbi = CONSOLE_SCREEN_BUFFER_INFO()
    kernel32.GetConsoleScreenBufferInfo(stream, byref(csbi))

    pos = csbi.dwCursorPosition
    # zero based, add ones for compatibility.
    return (pos.X + 1, pos.Y + 1)