code: def verify_single_allocation(stmt, alloc_size=None):
      num_alloc = [0]
      alloc_extents = []
  
      def verify(n):
          if (
              isinstance(n, tvm.tir.Block)
              and n.alloc_buffers is not None
              and (
                  True
                  in (
                      (buf.scope() == "shared.dyn")
                      for buf in n.alloc_buffers
                  )
              )
          ):
              num_alloc[0] += len(n.alloc_buffers)
              for buf in n.alloc_buffers:
                  alloc_extents.append(buf.shape)
  
      tvm.tir.stmt_functor.post_order_visit(stmt, verify)
      assert num_alloc[0] == 1
  
      if alloc_size:
  
          def prod(arr):
              ret = 1
              for element in arr:
                  ret *= element
              return ret
  
          assert prod(alloc_extents[0]) == alloc_size
  
imports: import tvm
  from tvm import te
  from tvm.script import tir
  import sys
  import pytest
label_desc: Use image node_id 8 for calling a global function with example usage: verify_single_allocation(stmt, alloc_size) and returns: ret