code: def stack_designs(*pairs):
      r"""Stack a sequence of design / contrast dictionary pairs
  
      Uses multiple calls to :func:`stack2designs`
  
      Parameters
      ----------
      \*pairs : sequence
          Elements of either (np.ndarray, dict) or (np.ndarray,) or np.ndarray
  
      Returns
      -------
      X : np.ndarray
         new design matrix:  np.hstack([old_X, new_X])
      contrasts : dict
         The new contrast matrices reflecting changes to the columns.
      """
      X = []
      contrasts = {}
      for p in pairs:
          if isinstance(p, np.ndarray):
              new_X = p
              new_con = {}
          elif len(p) == 1:  # Length one sequence
              new_X = p[0]
              new_con = {}
          else:  # Length 2 sequence
              new_X, new_con = p
          X, contrasts = stack2designs(X, new_X, contrasts, new_con)
      return X, contrasts
  
imports: import itertools
  from functools import reduce
  from operator import mul
  import numpy
  from nipy.algorithms.statistics.formula import formulae
  from nipy.algorithms.statistics.formula.formulae import Factor, Formula, Term, make_recarray
  from nipy.algorithms.statistics.utils import combinations
  from .hrf import glover
  from .utils import T, blocks, convolve_functions, events
  from .utils import fourier_basis
label_desc: Use image node_id 8 for calling a global function with example usage: stack_designs() and returns: X,  contrasts