code: def expected_utility(a, s, U, mdp):
      "The expected utility of doing a in state s, according to the MDP and U."
      return sum([p * U[s1] for (p, s1) in mdp.T(s, a)]f expected_utility(a, s, U, mdp):
      "The expected utility of doing a in state s, according to the MDP and U."
      return sum([p * U[s1] for (p, s1) in mdp.T(s, a)])
docs: The expected utility of doing a in state s, according to the MDP and U.