code: def check_iter_of_sequences(sequences, allow_trajectory=False, ndim=2,
                              max_iter=None):
      
      value = True
      for i, X in enumerate(sequences):
          if not isinstance(X, np.ndarray):
              if (not allow_trajectory) and isinstance(X, md.Trajectory):
                  value = False
                  break
          if not isinstance(X, md.Trajectory) and X.ndim != ndim:
              value = False
              break
          if max_iter is not None and i >= max_iter:
              break
  
      if not value:
          raise ValueError('sequences must be a list of sequences')
docs: Check that ``sequences`` is a iterable of trajectory-like sequences,
      suitable as input to ``fit()`` for estimators following the MSMBuilder
      API.
  
      Parameters
      ----------
      sequences : object
          The object to check
      allow_trajectory : bool
          Are ``md.Trajectory``s allowed?
      ndim : int
          The expected dimensionality of the sequences
      max_iter : int, optional
          Only check at maximum the first ``max_iter`` entries in ``sequences``.