code: def test_align_bit_offset_auto():
      M = 10
      n = M * (2**8 - 1)
      # Represent an integer as a Pyarrow buffer of bytes.
      bytes_ = n.to_bytes(M, sys.byteorder)
      buf = pa.py_buffer(bytes_)
      for slice_len in range(1, M):
          for bit_offset in range(1, n - slice_len * 8):
              byte_length = (
                  _bytes_for_bits(bit_offset + slice_len * 8) // 8
              )
              # Shift the buffer to eliminate the offset.
              out_buf = _align_bit_offset(buf, bit_offset, byte_length)
              # Check that shifted buffer is equivalent to our base int shifted by the
              # same number of bits.
              assert int.from_bytes(
                  out_buf.to_pybytes(), sys.byteorder
              ) == (n >> bit_offset)
  
imports: import logging
  import os
  import sys
  from unittest import mock
  import numpy
  import pyarrow
  import pyarrow.parquet
  import pytest
  from packaging.version import parse
  from pytest_lazyfixture import lazy_fixture
  import ray
  import ray.cloudpickle
  from ray._private.arrow_serialization import _align_bit_offset, _bytes_for_bits, _copy_bitpacked_buffer_if_needed, _copy_buffer_if_needed, _copy_normal_buffer_if_needed, _copy_offsets_buffer_if_needed
  from ray._private.utils import _get_pyarrow_version
  from ray.data.extensions.tensor_extension import ArrowTensorArray, ArrowVariableShapedTensorArray
  from ray.tests.conftest import *
label_desc: Use image node_id 3 for calling a global function with example usage: test_align_bit_offset_auto() without return types