code: def round2precision(val, precision: int = 0, which: str = ""):
      assert precision >= 0
      val *= 10**precision
      round_callback = round
      if which.lower() == "up":
          round_callback = math.ceil
      if which.lower() == "down":
          round_callback = math.floor
      return "{1:.{0}f}".format(
          precision, round_callback(val) / 10**precision
      )
  
file_path: ludwig/ludwig/utils/math_utils.py
imports: import math
  from typing import List
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: round2precision(val, precision, which) and returns: str