code: def getfloat_attr(obj, attr, length=11):
      """Format an attribute of an object for printing."""
      val = getattr(obj, attr, None)
      if val is None:
          return "unknown"
      if isinstance(val, int):
          return f"{val}"
      if isinstance(val, float):
          return gformat(val, length=length).strip()
      return repr(val)
  
file_path: lmfit-py/lmfit/printfuncs.py
imports: from math import log10
  import re
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: getfloat_attr(obj, attr, length) and returns: repr, str, val, gformat