code: def _format_float(value: float):
      if math.isnan(value):
          return " " * 5 + "nan"
  
      if abs(value) < 1e-9:
          lg = 0
      else:
          lg = int(math.ceil(math.log10(abs(value)))) + 1
  
      decimals = 7 - lg
      decimals = max(1, decimals)
      decimals = min(6, decimals)
  
      fmt = "{v:8,." + str(decimals) + "f}"
      return fmt.format(v=value)
  
imports: import collections
  import math
  from typing import TYPE_CHECKING, List, Tuple
  from labml.internal.util.colors import StyleCode
  from ....logger import Text
label_desc: Use image node_id 3 for calling a global function with example usage: _format_float(value) and returns: fmt, unknown