def fmt_partition(partition):
    """Format a |Bipartition|.

    The returned string looks like::

        0,1    ∅
        ─── ✕ ───
         2    0,1

    Args:
        partition (Bipartition): The partition in question.

    Returns:
        str: A human-readable string representation of the partition.
    """
    if not partition:
        return ''

    parts = [fmt_part(part, partition.node_labels).split('\n')
             for part in partition]

    times = ('   ',
             ' {} '.format(MULTIPLY),
             '   ')
    breaks = ('\n', '\n', '')  # No newline at the end of string
    between = [times] * (len(parts) - 1) + [breaks]

    # Alternate [part, break, part, ..., end]
    elements = chain.from_iterable(zip(parts, between))

    # Transform vertical stacks into horizontal lines
    return ''.join(chain.from_iterable(zip(*elements)))
def fmt_partition ( partition ) : if not partition : return '' parts = [ fmt_part ( part , partition . node_labels ) . split ( '\n' ) for part in partition ] times = ( '   ' , ' {} ' . format ( MULTIPLY ) , '   ' ) breaks = ( '\n' , '\n' , '' ) between = [ times ] * ( len ( parts ) - 1 ) + [ breaks ] elements = chain . from_iterable ( zip ( parts , between ) ) return '' . join ( chain . from_iterable ( zip ( * elements ) ) )
Format a |Bipartition|.

    The returned string looks like::

        0,1    ∅
        ─── ✕ ───
         2    0,1

    Args:
        partition (Bipartition): The partition in question.

    Returns:
        str: A human-readable string representation of the partition.