code: def float_formatter(f: Union[float, int]) -> str:
      """
      Format a float as a pretty string.
      """
      if f != f:
          # instead of returning nan, return "" so it shows blank in table
          return ""
      if isinstance(f, int):
          # don't do any rounding of integers, leave them alone
          return str(f)
      if f >= 1000:
          # numbers > 1000 just round to the nearest integer
          s = f"{f:.0f}"
      else:
          # otherwise show 4 significant figures, regardless of decimal spot
          s = f"{f:.4g}"
      # replace leading 0's with blanks for easier reading
      # example:  -0.32 to -.32
      s = s.replace("-0.", "-.")
      if s.startswith("0."):
          s = s[1:]
      # Add the trailing 0's to always show 4 digits
      # example: .32 to .3200
      if s[0] == "." and len(s) < 5:
          s += "0" * (5 - len(s))
      return s
  
imports: from collections import deque, OrderedDict
  from typing import Union, Optional, Set, Any, Dict, List, Tuple
  from datetime import timedelta
  import functools
  import math
  import time
  import re
  import shutil
  import json
  import os
  from parlai.core.message import Message
  from parlai.utils.strings import colorize
  from parlai.utils.io import PathManager
  import parlai.utils.logging
label_desc: Use image node_id 4 for calling a global function with example usage: float_formatter(f) and returns: s, str, str