code: def _fmt_auto(cls, x, **kw):
          
          f = cls._to_float(x)
          if abs(f) > 1e8:
              fn = cls._fmt_exp
          else:
              if f - round(f) == 0:
                  fn = cls._fmt_int
              else:
                  fn = cls._fmt_float
          return fn(x, **kw)
docs: auto formatting class-method.