code: def calculate_block_traversal_mode(
      is_depthwise: bool,
      weights_shape_ohwi: List[int],
      ifm_bitdepth: int,
  ) -> vapi.NpuBlockTraversal:
      """Calculate a block traversal mode given whether the op is depthwise convolution,
      shape of weights and bit-depth of the ifm.
      """
  
      if is_depthwise:
          return vapi.NpuBlockTraversal.DEPTH_FIRST
      # Determine which block traversal strategy has better DPU utilization
      kernel_size = weights_shape_ohwi[1] * weights_shape_ohwi[2]
      depth_utilization = weights_shape_ohwi[3] / util.round_up(
          weights_shape_ohwi[3], 32 if ifm_bitdepth == 8 else 16
      )
      part_kernel_utilization = (
          weights_shape_ohwi[3]
          / util.round_up(weights_shape_ohwi[3], 8)
      ) * (
          kernel_size
          / util.round_up(kernel_size, 4 if ifm_bitdepth == 8 else 2)
      )
      if (
          part_kernel_utilization >= depth_utilization
          or weights_shape_ohwi[3] <= 8
      ):
          # Part-kernel first is always better for ifm depths <= 8
          return vapi.NpuBlockTraversal.PART_KERNEL_FIRST
      return vapi.NpuBlockTraversal.DEPTH_FIRST
  
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 6 for calling a global function with example usage: calculate_block_traversal_mode(is_depthwise, weights_shape_ohwi, ifm_bitdepth) and returns: vapi, vapi, vapi