code: def root(arg, n, k=0, evaluate=None):
      r"""Returns the *k*-th *n*-th root of ``arg``.
  
      Parameters
      ==========
  
      k : int, optional
          Should be an integer in $\{0, 1, ..., n-1\}$.
          Defaults to the principal root if $0$.
  
      evaluate : bool, optional
          The parameter determines if the expression should be evaluated.
          If ``None``, its value is taken from
          ``global_parameters.evaluate``.
  
      Examples
      ========
  
      >>> from sympy import root, Rational
      >>> from sympy.abc import x, n
  
      >>> root(x, 2)
      sqrt(x)
  
      >>> root(x, 3)
      x**(1/3)
  
      >>> root(x, n)
      x**(1/n)
  
      >>> root(x, -Rational(2, 3))
      x**(-3/2)
  
      To get the k-th n-th root, specify k:
  
      >>> root(-2, 3, 2)
      -(-1)**(2/3)*2**(1/3)
  
      To get all n n-th roots you can use the rootof function.
      The following examples show the roots of unity for n
      equal 2, 3 and 4:
  
      >>> from sympy import rootof
  
      >>> [rootof(x**2 - 1, i) for i in range(2)]
      [-1, 1]
  
      >>> [rootof(x**3 - 1,i) for i in range(3)]
      [1, -1/2 - sqrt(3)*I/2, -1/2 + sqrt(3)*I/2]
  
      >>> [rootof(x**4 - 1,i) for i in range(4)]
      [-1, 1, -I, I]
  
      SymPy, like other symbolic algebra systems, returns the
      complex root of negative numbers. This is the principal
      root and differs from the text-book result that one might
      be expecting. For example, the cube root of -8 does not
      come back as -2:
  
      >>> root(-8, 3)
      2*(-1)**(1/3)
  
      The real_root function can be used to either make the principal
      result real (or simply to return the real root directly):
  
      >>> from sympy import real_root
      >>> real_root(_)
      -2
      >>> real_root(-32, 5)
      -2
  
      Alternatively, the n//2-th n-th root of a negative number can be
      computed with root:
  
      >>> root(-32, 5, 5//2)
      -2
  
      See Also
      ========
  
      sympy.polys.rootoftools.rootof
      sympy.core.intfunc.integer_nthroot
      sqrt, real_root
  
      References
      ==========
  
      .. [1] https://en.wikipedia.org/wiki/Square_root
      .. [2] https://en.wikipedia.org/wiki/Real_root
      .. [3] https://en.wikipedia.org/wiki/Root_of_unity
      .. [4] https://en.wikipedia.org/wiki/Principal_value
      .. [5] https://mathworld.wolfram.com/CubeRoot.html
  
      """
      n = sympify(n)
      if k:
          return Mul(
              Pow(arg, S.One / n, evaluate=evaluate),
              S.NegativeOne ** (2 * k / n),
              evaluate=evaluate,
          )
      return Pow(arg, 1 / n, evaluate=evaluate)
  
imports: from sympy.core import Function, S, sympify, NumberKind
  from sympy.utilities.iterables import sift
  from sympy.core.add import Add
  from sympy.core.containers import Tuple
  from sympy.core.operations import LatticeOp, ShortCircuit
  from sympy.core.function import Application, Lambda, ArgumentIndexError
  from sympy.core.expr import Expr
  from sympy.core.exprtools import factor_terms
  from sympy.core.mod import Mod
  from sympy.core.mul import Mul
  from sympy.core.numbers import Rational
  from sympy.core.power import Pow
  from sympy.core.relational import Eq, Relational
  from sympy.core.singleton import Singleton
  from sympy.core.sorting import ordered
  from sympy.core.symbol import Dummy
  from sympy.core.rules import Transform
  from sympy.core.logic import fuzzy_and, fuzzy_or, _torf
  from sympy.core.traversal import walk
  from sympy.core.numbers import Integer
  from sympy.logic.boolalg import And, Or
label_desc: Use image node_id 4 for calling a global function with example usage: root(arg, n, k, evaluate) and returns: Pow, Mul