code: def str_format(v: float) -> str:
      """Preferred basic formatter"""
      if np.isnan(v):
          return "        "
      av = abs(v)
      digits = 0
      if av != 0:
          digits = int(np.ceil(np.log10(av)))
      if digits > 4 or digits <= -4:
          return f"{v:8.4g}"
  
      if digits > 0:
          d = int(5 - digits)
      else:
          d = int(4)
  
      format_str = "{0:" + f"0.{d}f" + "}"
      return format_str.format(v)
  
imports: from __future__ import annotations
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: str_format(v) and returns: format_str, str, v