code: def clips_array(
      array, rows_widths=None, cols_heights=None, bg_color=None
  ):
      """Given a matrix whose rows are clips, creates a CompositeVideoClip where
      all clips are placed side by side horizontally for each clip in each row
      and one row on top of the other for each row. So given next matrix of clips
      with same size:
  
      ```python
      clips_array([[clip1, clip2, clip3], [clip4, clip5, clip6]])
      ```
  
      the result will be a CompositeVideoClip with a layout displayed like:
  
      ```
      ┏━━━━━━━┳━━━━━━━┳━━━━━━━┓
      ┃       ┃       ┃       ┃
      ┃ clip1 ┃ clip2 ┃ clip3 ┃
      ┃       ┃       ┃       ┃
      ┣━━━━━━━╋━━━━━━━╋━━━━━━━┫
      ┃       ┃       ┃       ┃
      ┃ clip4 ┃ clip5 ┃ clip6 ┃
      ┃       ┃       ┃       ┃
      ┗━━━━━━━┻━━━━━━━┻━━━━━━━┛
      ```
  
      If some clips doesn't fulfill the space required by the rows or columns
      in which are placed, that space will be filled by the color defined in
      ``bg_color``.
  
      array
        Matrix of clips included in the returned composited video clip.
  
      rows_widths
        Widths of the different rows in pixels. If ``None``, is set automatically.
  
      cols_heights
        Heights of the different columns in pixels. If ``None``, is set automatically.
  
      bg_color
         Fill color for the masked and unfilled regions. Set to ``None`` for these
         regions to be transparent (processing will be slower).
      """
      array = np.array(array)
      sizes_array = np.array(
          [[clip.size for clip in line] for line in array]
      )
  
      # find row width and col_widths automatically if not provided
      if rows_widths is None:
          rows_widths = sizes_array[:, :, 1].max(axis=1)
      if cols_heights is None:
          cols_heights = sizes_array[:, :, 0].max(axis=0)
  
      # compute start positions of X for rows and Y for columns
      xs = np.cumsum([0] + list(cols_heights))
      ys = np.cumsum([0] + list(rows_widths))
  
      for j, (x, ch) in enumerate(zip(xs[:-1], cols_heights)):
          for i, (y, rw) in enumerate(zip(ys[:-1], rows_widths)):
              clip = array[i, j]
              w, h = clip.size
              # if clip not fulfill row width or column height
              if (w < ch) or (h < rw):
                  clip = CompositeVideoClip(
                      [clip.with_position("center")],
                      size=(ch, rw),
                      bg_color=bg_color,
                  ).with_duration(clip.duration)
  
              array[i, j] = clip.with_position((x, y))
  
      return CompositeVideoClip(
          array.flatten(), size=(xs[-1], ys[-1]), bg_color=bg_color
      )
  
file_path: moviepy/moviepy/video/compositing/CompositeVideoClip.py
imports: import numpy
  from PIL import Image
  from moviepy.audio.AudioClip import CompositeAudioClip
  from moviepy.video.VideoClip import ColorClip, VideoClip
label_desc: Use image node_id 1 for calling a global function with example usage: clips_array(array, rows_widths, cols_heights, bg_color) and returns: CompositeVideoClip