python – How do I validate tic-tac-toe game ending scenario

I have created a simple program for tic tac toe. I need help on last part of the program.
the program checks if the game is over – there are four possible verdicts: the game should continue, or the game ends with a tie, your win, or the computer’s win; Can some one please help.

Also, area where I can improve.

import random


def board():
    "Creating Board dictionary"
    dic_board = {}
    v = 1
    for i in range(3):
        for j in range(3):
            k = str(i) + str(j)
            dic_board(k) = v
            v += 1
    update_board(dic_board)


def draw_board(board):
    """Draw board"""
    for i in range(3):
        print('+' + '-' * 5 + '+' + '-' * 5 + '+' + '-' * 5 + '+', end='')
        print()
        print('|' + ' ' * 5 + '|' + ' ' * 5 + '|' + ' ' * 5 + '|')
        for j in range(3):
            k = str(i) + str(j)
            print('| ' + str(board(k)) + ' ' * 3, end='')
        print('|')
        print('|' + ' ' * 5 + '|' + ' ' * 5 + '|' + ' ' * 5 + '|')
    print('+' + '-' * 5 + '+' + '-' * 5 + '+' + '-' * 5 + '+', end='')
    print()

def update_board(board):
    """the first move belongs to the computer -
    it always puts its first 'X' in the middle of the board that is at 5;"""
    total_moves = 0
    flag = True
    while total_moves < 8 :
        available_num = (v for k, v in board.items() if v not in ('X','O'))
        if flag :
            if total_moves == 0:
                Update_moves(board, 'Comp', 5)
                flag = False
            else:

                num = random.choice(available_num)
                Update_moves(board, 'Comp', num)
                flag = False
        else:
            try:
                s = str(available_num)
                val = int(input('Select Number '+ s + ': '))
                Update_moves(board, 'User', val)
                flag = True
            except:
                print('Invalid Input!!')
        total_moves += 1
        draw_board(board)
    return board


def Update_moves(board, moves,val):
    "Updating borad as per input"
    key_to_update = (k for k, v in board.items() if v == val)
    if moves == 'Comp':
        board(key_to_update(0)) = 'X'
    elif moves == 'User':
        board(key_to_update(0)) = 'O'
    return board

print(board())