code: def rs_fun(p, f, *args):
      r"""
      Function of a multivariate series computed by substitution.
  
      The case with f method name is used to compute `rs\_tan` and `rs\_nth\_root`
      of a multivariate series:
  
          `rs\_fun(p, tan, iv, prec)`
  
          tan series is first computed for a dummy variable _x,
          i.e, `rs\_tan(\_x, iv, prec)`. Then we substitute _x with p to get the
          desired series
  
      Parameters
      ==========
  
      p : :class:`~.PolyElement` The multivariate series to be expanded.
      f : `ring\_series` function to be applied on `p`.
      args[-2] : :class:`~.PolyElement` with respect to which, the series is to be expanded.
      args[-1] : Required order of the expanded series.
  
      Examples
      ========
  
      >>> from sympy.polys.domains import QQ
      >>> from sympy.polys.rings import ring
      >>> from sympy.polys.ring_series import rs_fun, _tan1
      >>> R, x, y = ring('x, y', QQ)
      >>> p = x + x*y + x**2*y + x**3*y**2
      >>> rs_fun(p, _tan1, x, 4)
      1/3*x**3*y**3 + 2*x**3*y**2 + x**3*y + 1/3*x**3 + x**2*y + x*y + x
      """
      _R = p.ring
      R1, _x = ring("_x", _R.domain)
      h = int(args[-1])
      args1 = args[:-2] + (_x, h)
      zm = _R.zero_monom
      # separate the constant term of the series
      # compute the univariate series f(_x, .., 'x', sum(nv))
      if zm in p:
          x1 = _x + p[zm]
          p1 = p - p[zm]
      else:
          x1 = _x
          p1 = p
      if isinstance(f, str):
          q = getattr(x1, f)(*args1)
      else:
          q = f(x1, *args1)
      a = sorted(q.items())
      c = [0] * h
      for x in a:
          c[x[0][0]] = x[1]
      p1 = rs_series_from_list(p1, c, args[-2], args[-1])
      return p1
  
imports: from sympy.polys.domains import QQ, EX
  from sympy.polys.rings import PolyElement, ring, sring
  from sympy.polys.polyerrors import DomainError
  from sympy.polys.monomials import monomial_min, monomial_mul, monomial_div, monomial_ldiv
  from mpmath.libmp.libintmath import ifac
  from sympy.core import PoleError, Function, Expr
  from sympy.core.numbers import Rational
  from sympy.core.intfunc import igcd
  from sympy.functions import sin, cos, tan, atan, exp, atanh, tanh, log, ceiling
  from sympy.utilities.misc import as_int
  from mpmath.libmp.libintmath import giant_steps
  import math
label_desc: Use image node_id 21 for calling a global function with example usage: rs_fun(p, f) and returns: p1