code: def maybe_split_array(arr, chunked):
      if not chunked:
          return arr
      elif arr.dtype.storage != "pyarrow":
          return arr
  
      pa = pytest.importorskip("pyarrow")
  
      arrow_array = arr._pa_array
      split = len(arrow_array) // 2
      arrow_array = pa.chunked_array(
          [*arrow_array[:split].chunks, *arrow_array[split:].chunks]
      )
      assert arrow_array.num_chunks == 2
      return type(arr)(arrow_array)
  
imports: from __future__ import annotations
  import string
  from typing import cast
  import numpy
  import pytest
  import pandas
  import pandas._testing
  from pandas.api.types import is_string_dtype
  from pandas.core.arrays import ArrowStringArray
  from pandas.core.arrays.string_ import StringDtype
  from pandas.tests.extension import base
label_desc: Use image node_id 1 for calling a global function with example usage: maybe_split_array(arr, chunked) and returns: type, arr, arr