code: def swapaxes(vari, ax1, ax2):
      
      if isinstance(vari, Poly):
          core = vari.A.copy()
          for key in vari.keys:
              core[key] = swapaxes(core[key], ax1, ax2)
  
          return Poly(core, vari.dim, None, vari.dtype)
  
      return numpy.swapaxes(vari, ax1, ax2)
docs: Interchange two axes of a polynomial.