code: def fit(self, sequences, y=None):
          
          self._build_counts(sequences)
  
          # use a dict like a switch statement: dispatch to different
          # transition matrix estimators depending on the value of
          # self.reversible_type
          fit_method_map = {
              'mle': self._fit_mle,
              'transpose': self._fit_transpose,
              'none': self._fit_asymetric}
  
          try:
              # pull out the appropriate method
              fit_method = fit_method_map[str(self.reversible_type).lower()]
              # step 3. estimate transition matrix
              self.transmat_, self.populations_ = fit_method(self.countsmat_)
          except KeyError:
              raise ValueError('reversible_type must be one of %s: %s' % (
                  ', '.join(fit_method_map.keys()), self.reversible_type))
  
          self._is_dirty = True
          return self
docs: Estimate model parameters.
  
          Parameters
          ----------
          sequences : list of array-like
              List of sequences, or a single sequence. Each sequence should be a
              1D iterable of state labels. Labels can be integers, strings, or
              other orderable objects.
  
          Returns
          -------
          self
  
          Notes
          -----
          `None` and `NaN` are recognized immediately as invalid labels.
          Therefore, transition counts from or to a sequence item which is NaN or
          None will not be counted. The mapping_ attribute will not include the
          NaN or None.