code: def pad2d(data, padding):
      
  
      data = np.array(data)
  
      if isinstance(padding, int):
          padding = np.array([padding])
      elif isinstance(padding, (tuple, list)):
          padding = np.array(padding)
      elif isinstance(padding, np.ndarray):
          pass
      else:
          raise ValueError('Padding must be an integer or a tuple (or list, '
                           'np.ndarray) of itegers')
  
      if padding.size == 1:
          padding = np.repeat(padding, 2)
  
      return np.pad(data, ((padding[0], padding[0]), (padding[1], padding[1])),
                    'constant')
docs: Pad array
  
      This method pads an input numpy array with zeros in all directions.
  
      Parameters
      ----------
      data : np.ndarray
          Input data array (at least 2D)
      padding : int, tuple
          Amount of padding in x and y directions, respectively
  
      Returns
      -------
      np.ndarray padded data
  
      Notes
      -----
      Adjustment to numpy.pad()
  
      Examples
      --------
      >>> from modopt.base.np_adjust import pad2d
      >>> x = np.arange(9).reshape((3, 3))
      >>> x
      array([[0, 1, 2],
             [3, 4, 5],
             [6, 7, 8]])
      >>> pad2d(x, (1, 1))
      array([[0, 0, 0, 0, 0],
             [0, 0, 1, 2, 0],
             [0, 3, 4, 5, 0],
             [0, 6, 7, 8, 0],
             [0, 0, 0, 0, 0]])