docs: def pad(a, desiredlength):
      """
      Pad an n-dimensional numpy array with zeros along the zero-th dimension
      so that it is the desired length.  Return it unchanged if it is greater
      than or equal to the desired length
      """
  
      if len(a) >= desiredlength:
          return a
  
      islist = isinstance(a, list)
      a = np.array(a)
      diff = desiredlength - len(a)
      shape = list(a.shape)
      shape[0] = diff
  
      padded = np.concatenate([a, np.zeros(shape, dtype=a.dtype)])
      return padded.tolist() if islist else padded