code: def scalar_potential(field, coord_sys):
      """
      Returns the scalar potential function of a field in a given
      coordinate system (without the added integration constant).
  
      Parameters
      ==========
  
      field : Vector
          The vector field whose scalar potential function is to be
          calculated
  
      coord_sys : CoordSys3D
          The coordinate system to do the calculation in
  
      Examples
      ========
  
      >>> from sympy.vector import CoordSys3D
      >>> from sympy.vector import scalar_potential, gradient
      >>> R = CoordSys3D('R')
      >>> scalar_potential(R.k, R) == R.z
      True
      >>> scalar_field = 2*R.x**2*R.y*R.z
      >>> grad_field = gradient(scalar_field)
      >>> scalar_potential(grad_field, R)
      2*R.x**2*R.y*R.z
  
      """
  
      # Check whether field is conservative
      if not is_conservative(field):
          raise ValueError("Field is not conservative")
      if field == Vector.zero:
          return S.Zero
      # Express the field exntirely in coord_sys
      # Substitute coordinate variables also
      if not isinstance(coord_sys, CoordSys3D):
          raise TypeError("coord_sys must be a CoordSys3D")
      field = express(field, coord_sys, variables=True)
      dimensions = coord_sys.base_vectors()
      scalars = coord_sys.base_scalars()
      # Calculate scalar potential function
      temp_function = integrate(field.dot(dimensions[0]), scalars[0])
      for i, dim in enumerate(dimensions[1:]):
          partial_diff = diff(temp_function, scalars[i + 1])
          partial_diff = field.dot(dim) - partial_diff
          temp_function += integrate(partial_diff, scalars[i + 1])
      return temp_function
  
imports: from sympy.vector.coordsysrect import CoordSys3D
  from sympy.vector.deloperator import Del
  from sympy.vector.scalar import BaseScalar
  from sympy.vector.vector import Vector, BaseVector
  from sympy.vector.operators import gradient, curl, divergence
  from sympy.core.function import diff
  from sympy.core.singleton import S
  from sympy.integrals.integrals import integrate
  from sympy.simplify.simplify import simplify
  from sympy.core import sympify
  from sympy.vector.dyadic import Dyadic
label_desc: Use image node_id 6 for calling a global function with example usage: scalar_potential(field, coord_sys) and returns: temp_function, S