code: def _concatenate_array_managers(
      mgrs_indexers, axes: list[Index], concat_axis: AxisInt, copy: bool
  ) -> Manager:
      """
      Concatenate array managers into one.
  
      Parameters
      ----------
      mgrs_indexers : list of (ArrayManager, {axis: indexer,...}) tuples
      axes : list of Index
      concat_axis : int
      copy : bool
  
      Returns
      -------
      ArrayManager
      """
      # reindex all arrays
      mgrs = []
      for mgr, indexers in mgrs_indexers:
          axis1_made_copy = False
          for ax, indexer in indexers.items():
              mgr = mgr.reindex_indexer(
                  axes[ax],
                  indexer,
                  axis=ax,
                  allow_dups=True,
                  use_na_proxy=True,
              )
              if ax == 1 and indexer is not None:
                  axis1_made_copy = True
          if copy and concat_axis == 0 and not axis1_made_copy:
              # for concat_axis 1 we will always get a copy through concat_arrays
              mgr = mgr.copy()
          mgrs.append(mgr)
  
      if concat_axis == 1:
          # concatting along the rows -> concat the reindexed arrays
          # TODO(ArrayManager) doesn't yet preserve the correct dtype
          arrays = [
              concat_arrays(
                  [mgrs[i].arrays[j] for i in range(len(mgrs))]
              )
              for j in range(len(mgrs[0].arrays))
          ]
      else:
          # concatting along the columns -> combine reindexed arrays in a single manager
          assert concat_axis == 0
          arrays = list(
              itertools.chain.from_iterable(
                  [mgr.arrays for mgr in mgrs]
              )
          )
  
      new_mgr = ArrayManager(
          arrays, [axes[1], axes[0]], verify_integrity=False
      )
      return new_mgr
  
imports: from __future__ import annotations
  import copy
  import itertools
  from typing import TYPE_CHECKING, Sequence, cast
  import numpy
  from pandas._libs import NaT, internals
  from pandas._libs.missing import NA
  from pandas._typing import ArrayLike, AxisInt, DtypeObj, Manager, Shape
  from pandas.util._decorators import cache_readonly
  from pandas.core.dtypes.astype import astype_array
  from pandas.core.dtypes.cast import ensure_dtype_can_hold_na, find_common_type, np_find_common_type
  from pandas.core.dtypes.common import is_1d_only_ea_dtype, is_dtype_equal, is_scalar, needs_i8_conversion
  from pandas.core.dtypes.concat import concat_compat
  from pandas.core.dtypes.dtypes import DatetimeTZDtype, ExtensionDtype
  from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna, isna_all
  import pandas.core.algorithms
  from pandas.core.arrays import DatetimeArray, ExtensionArray
  from pandas.core.arrays.sparse import SparseDtype
  from pandas.core.construction import ensure_wrapped_if_datetimelike
  from pandas.core.internals.array_manager import ArrayManager, NullArrayProxy
  from pandas.core.internals.blocks import ensure_block_shape, new_block_2d
  from pandas.core.internals.managers import BlockManager
label_desc: Use image node_id 1 for calling a global function with example usage: _concatenate_array_managers(mgrs_indexers, axes, concat_axis, copy) and returns: new_mgr