code: def array_resize(
      array: Union[Tuple, List], length: int, array_len: int = None
  ) -> Union[Tuple, List]:
      """
      Resize array to given length. If the array is shorter than given length, repeat the array; If the array is longer
      than the length, trim the array.
      :param array: array
      :param length: target length
      :param array_len: if length of original array is known, pass it in here
      :return: resized array
      """
      if not array_len:
          array_len = len(array)
      return array * (length // array_len) + array[: length % array_len]
  
imports: import copy
  import math
  from itertools import islice, product
  from typing import Dict, Iterable, Iterator, List, Optional, Tuple, Union
  import warnings
  import matplotlib.font_manager
  from matplotlib.axes import Axes
  from matplotlib.figure import Figure
  from matplotlib.patches import Patch, Rectangle
  from matplotlib.pyplot import cm
label_desc: Use image node_id 3 for calling a global function with example usage: array_resize(array, length, array_len) and returns: unknown