code: def _quantize_scale(scale: float) -> Tuple[int, int]:
      """Quantize floating point scale into 32-bit int scale with a 6-bit shift.
      This is to be used with 8-bit data.
      """
      mantissa, exponent = math.frexp(scale)
      mantissa_scaled = mantissa * (1 << 31)
      mantissa_scaled = int(util.round_away_zero(mantissa_scaled))
      required_shift = 31 - exponent
      if required_shift < 0 or required_shift >= (1 << 6):
          # Shift outside of valid range, set scale to 0
          return 0, 16
  
      return mantissa_scaled, required_shift
  
imports: import logging
  import math
  from typing import List, Optional, Tuple
  import numpy
  from ethosu.vela import api
  from ethosu.vela.architecture_allocator import find_block_config
  from ethosu.vela.architecture_features import Accelerator, create_default_arch
  from ethosu.vela.operation import NpuBlockType
  from ethosu.vela.register_command_stream_generator import resampling_mode_map
  from ethosu.vela.register_command_stream_util import to_kernel
  from ethosu.vela.shape4d import Shape4D
  import tvm
  from tvm.relay.backend.contrib.ethosu import tir_to_cs_translator
  from tvm.relay.backend.contrib.ethosu import util
label_desc: Use image node_id 8 for calling a global function with example usage: _quantize_scale(scale) and returns: mantissa_scaled,  required_shift, int,  int