code: def directed_tripartition(seq):
      
      for a, b, c in directed_tripartition_indices(len(seq)):
          yield (tuple(seq[i] for i in a),
                 tuple(seq[j] for j in b),
                 tuple(seq[k] for k in c))
docs: Generator over all directed tripartitions of a sequence.
  
      Args:
          seq (Iterable): a sequence.
  
      Yields:
          tuple[tuple]: A tripartition of ``seq``.
  
      Example:
          >>> seq = (2, 5)
          >>> list(directed_tripartition(seq))  # doctest: +NORMALIZE_WHITESPACE
          [((2, 5), (), ()),
           ((2,), (5,), ()),
           ((2,), (), (5,)),
           ((5,), (2,), ()),
           ((), (2, 5), ()),
           ((), (2,), (5,)),
           ((5,), (), (2,)),
           ((), (5,), (2,)),
           ((), (), (2, 5))]