code: def check_bytes_allocated(f):
      @wraps(f)
      def wrapper(*args, **kwargs):
          allocated_bytes = pa.total_allocated_bytes()
          try:
              return f(*args, **kwargs)
          finally:
              assert pa.total_allocated_bytes() == allocated_bytes
  
      return wrapper
  
file_path: arrow/python/pyarrow/tests/test_dlpack.py
imports: import ctypes
  from functools import wraps
  import pytest
  import numpy
  import pyarrow
  from pyarrow.vendored.version import Version
label_desc: Use image node_id 3 for calling a global function with example usage: check_bytes_allocated(f) and returns: wrapper, f