code: def directed_bipartition(seq, nontrivial=False):
      
      bipartitions = [
          (tuple(seq[i] for i in part0_idx), tuple(seq[j] for j in part1_idx))
          for part0_idx, part1_idx in directed_bipartition_indices(len(seq))
      ]
      if nontrivial:
          # The first and last partitions have a part that is empty; skip them.
          # NOTE: This depends on the implementation of
          # `directed_partition_indices`.
          return bipartitions[1:-1]
      return bipartitions
docs: Return a list of directed bipartitions for a sequence.
  
      Args:
          seq (Iterable): The sequence to partition.
  
      Returns:
          list[tuple[tuple]]: A list of tuples containing each of the two
          parts.
  
      Example:
          >>> directed_bipartition((1, 2, 3))  # doctest: +NORMALIZE_WHITESPACE
          [((), (1, 2, 3)),
           ((1,), (2, 3)),
           ((2,), (1, 3)),
           ((1, 2), (3,)),
           ((3,), (1, 2)),
           ((1, 3), (2,)),
           ((2, 3), (1,)),
           ((1, 2, 3), ())]