code: def _trim_join_unit(join_unit: JoinUnit, length: int) -> JoinUnit:
      """
      Reduce join_unit's shape along item axis to length.
  
      Extra items that didn't fit are returned as a separate block.
      """
      if 0 not in join_unit.indexers:
          extra_indexers = join_unit.indexers
  
          if join_unit.block is None:
              extra_block = None
          else:
              extra_block = join_unit.block.getitem_block(
                  slice(length, None)
              )
              join_unit.block = join_unit.block.getitem_block(
                  slice(length)
              )
      else:
          extra_block = join_unit.block
  
          extra_indexers = cp.copy(join_unit.indexers)
          extra_indexers[0] = extra_indexers[0][length:]
          join_unit.indexers[0] = join_unit.indexers[0][:length]
  
      extra_shape = (join_unit.shape[0] - length,) + join_unit.shape[1:]
      join_unit.shape = (length,) + join_unit.shape[1:]
  
      return JoinUnit(
          block=extra_block, indexers=extra_indexers, shape=extra_shape
      )
  
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 12 for calling a global function with example usage: _trim_join_unit(join_unit, length) and returns: JoinUnit