code: def _inner_concatenate_np_array(
      np_arrays_to_concatenate: List[np.ndarray],
  ):
      """
      Concatenate numpy arrays on the last axis, expanding and broadcasting if necessary.
  
      :param np_arrays_to_concatenate: numpy arrays to zip with the other
      :type np_arrays_to_concatenate: Iterable[np.ndarray]
      :return: concatenated np array
      :rtype: np.ndarray
      """
      n_arrays = len(np_arrays_to_concatenate)
      target_n_dims = max(
          map(lambda x: len(x.shape), np_arrays_to_concatenate)
      )
      # These three next lines may be a bit hard to follow;
      # they compute the max for every dimensions of the np arrays except the last.
      # Previous code just assumed np_arrays_to_concatenate[0].shape[:-1]
      _temp = map(attrgetter("shape"), np_arrays_to_concatenate)
      _temp = map(
          lambda x: list(x)
          + [0 for _ in range(target_n_dims - len(x))],
          _temp,
      )
      target_dims_m1 = list(map(max, *list(_temp)))[:-1]
  
      for i in range(n_arrays):
          while len(np_arrays_to_concatenate[i].shape) < target_n_dims:
              np_arrays_to_concatenate[i] = np.expand_dims(
                  np_arrays_to_concatenate[i], axis=-1
              )
  
          target_shape = tuple(
              target_dims_m1 + [np_arrays_to_concatenate[i].shape[-1]]
          )
          np_arrays_to_concatenate[i] = np.broadcast_to(
              np_arrays_to_concatenate[i], target_shape
          )
  
      return np.concatenate(np_arrays_to_concatenate, axis=-1)
  
imports: import copy
  import math
  from operator import attrgetter
  from typing import Any, Callable, Generic, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
  import numpy
  import pandas
label_desc: Use image node_id 4 for calling a global function with example usage: _inner_concatenate_np_array(np_arrays_to_concatenate) and returns: np