<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rolldim(P, n=1):
 """ Roll the axes. Args: P (Poly) : Input polynomial. n (int) : The axis that after rolling becomes the 0th axis. Returns: (Poly) : Polynomial with new axis configuration. Examples: q0^3+q1^2+q2 q0^2+q2^3+q1 """

    dim = P.dim
    shape = P.shape
    dtype = P.dtype
    A = dict(((key[n:]+key[:n],P.A[key]) for key in P.keys))
    return Poly(A, dim, shape, dtype)