<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def expectation(P, obs):
 r"""Equilibrium expectation of given observable. Parameters P : (M, M) ndarray Transition matrix obs : (M,) ndarray Observable, represented as vector on state space Returns ------- x : float Expectation value """

    pi = statdist(P)
    return np.dot(pi, obs)