code: def _float8e4m3_to_float32_scalar(
      ival: int, fn: bool, uz: bool
  ) -> np.float32:
      if not fn:
          raise NotImplementedError("fn=False is not implemented.")
      if ival < 0 or ival > 255:  # noqa: PLR2004
          raise ValueError(f"{ival} is not a float8.")
      if uz:
          exponent_bias = 8
          if ival == 0x80:  # noqa: PLR2004
              return np.nan  # type: ignore[return-value]
      else:
          exponent_bias = 7
          if ival == 255:  # noqa: PLR2004
              return np.float32(-np.nan)
          if ival == 127:  # noqa: PLR2004
              return np.float32(np.nan)
  
      expo = (ival & 0x78) >> 3
      mant = ival & 0x07
      sign = ival & 0x80
      res = sign << 24
      if expo == 0:
          if mant > 0:
              expo = 0x7F - exponent_bias
              if mant & 0x4 == 0:
                  mant &= 0x3
                  mant <<= 1
                  expo -= 1
              if mant & 0x4 == 0:
                  mant &= 0x3
                  mant <<= 1
                  expo -= 1
              res |= (mant & 0x3) << 21
              res |= expo << 23
      else:
          res |= mant << 20
          expo += 0x7F - exponent_bias
          res |= expo << 23
      f = np.uint32(res).view(np.float32)
      return f
  
imports: import sys
  from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  from onnx import MapProto, OptionalProto, SequenceProto, TensorProto, helper, subbyte
  from onnx.external_data_helper import load_external_data_for_tensor, uses_external_data
label_desc: Use image node_id 3 for calling a global function with example usage: _float8e4m3_to_float32_scalar(ival, fn, uz) and returns: f, np, np, np