docs: def p(self, sequence, subsequence=True):
          """Returns the probability of the given sequence or subsequence (if subsequence=True, default)."""
          if sequence[0] != self.startstate:
              if isinstance(sequence, tuple):
                  sequence = (self.startstate,) + sequence
              else:
                  sequence = (self.startstate,) + tuple(sequence)
          if self.endstate:
              if sequence[-1] != self.endstate:
                  if isinstance(sequence, tuple):
                      sequence = sequence + (self.endstate,)
                  else:
                      sequence = tuple(sequence) + (self.endstate,)
  
          prevnode = None
          prob = 1
          for node in sequence:
              if prevnode:
                  try:
                      prob *= self.edges_out[prevnode][node]
                  except:
                      return 0
          return prob