Give me code for a functional game of Tic Tac Toe in Python for 2 players. 
The game rules are roughly as follows. 
1) Game board is a 3 by 3 grid.
2) At the beginning of each player's turn game checks if any valid moves are available. If there is an empty space then a valid move is available. 
3) Each player takes their turns putting down their mark, Player 1 places an X while Player 2 places a O. 
4) At the beginnings of each player's move the game checks if the move is valid. If the space has already been marked by another player the move is invalid and player is told to choose another space. 
5) After a valid move is made the game checks if the player has won. A player has won if they have 3 of their marks connected together horizontally or vertically or diagonally. 
6) If the player has not won the game it is now the other player's turn. 
7) This continues until a player wins or a draw is achieved. A draw is achieved when there are no more empty spaces on the game board and the game ends.