def utility_function(state, monte_carlo):
    """
    This functions takes in a state and performs monte carlo
    tree search. It returns the utility of the state and
    the reward for each possible actions.
    :param monte_carlo: a monte_carlo class
    :param state: The state should be in the form that monte_carlo requires.
    :return: U(state), Q(state,action) for all actions in A
    """
    monte_carlo.update(state)
    utility, q_values = monte_carlo.pick_move()

    return utility, q_values