code: def safe_round(number, ndigits):
      if hasattr(number, "__round__"):
          return round(number, ndigits)
      elif (
          torch is not None
          and torch.is_tensor(number)
          and number.numel() == 1
      ):
          return safe_round(number.item(), ndigits)
      elif (
          np is not None
          and np.ndim(number) == 0
          and hasattr(number, "item")
      ):
          return safe_round(number.item(), ndigits)
      else:
          return number
  
imports: import bisect
  import time
  from collections import OrderedDict
  from typing import Dict, Optional
label_desc: Use image node_id 1 for calling a global function with example usage: safe_round(number, ndigits) and returns: round, safe_round, safe_round, number