docs: def _check_periodic(periodic):
      '''Validate periodic input'''
      periodic = np.array(periodic)
  
      # If it is a matrix
      if len(periodic.shape) == 2:
          assert periodic.shape[0] == periodic.shape[1], 'periodic shoud be a square matrix or a flat array'
          return np.diag(periodic)
      elif len(periodic.shape) == 1:
          return periodic
      else:
          raise ValueError("periodic argument can be either a 3x3 matrix or a shape 3 array.")