# Path: solvebio/utils/printing.py
# TTY_COLS = set_from_env('COLUMNS', 80)


from six.moves import map
from six.moves import range
from six.moves import zip
from six import string_types
from collections import namedtuple
from platform import python_version_tuple
from .printing import TTY_COLS
    from itertools import izip_longest
    from itertools import zip_longest as izip_longest
    from functools import reduce
import re

    if sort and len(rows) > 1:
        rows = sorted(rows, key=lambda x: x[0])

    # pad with empty headers for initial columns if necessary
    if headers and len(rows) > 0:
        nhs = len(headers)
        ncols = len(rows[0])
        if nhs < ncols:
            headers = [""] * (ncols - nhs) + headers

    return rows, headers


def _build_row(cells, padding, begin, sep, end):
    "Return a string which represents a row of data cells."

    pad = " " * padding
    padded_cells = [pad + cell + pad for cell in cells]

    # SolveBio: we're only displaying Key-Value tuples (dimension of 2).
    #  enforce that we don't wrap lines by setting a max
    #  limit on row width which is equal to TTY_COLS (see printing)
    rendered_cells = (begin + sep.join(padded_cells) + end).rstrip()
    if len(rendered_cells) > TTY_COLS:
        if not cells[-1].endswith(" ") and not cells[-1].endswith("-"):
            terminating_str = " ... "
        else:
            terminating_str = ""
        rendered_cells = "{0}{1}{2}".format(

# Path: solvebio/utils/printing.py
# TTY_COLS = set_from_env('COLUMNS', 80)


# Path: solvebio/utils/tabulate.py
from six.moves import map
from six.moves import range
from six.moves import zip
from six import string_types
from collections import namedtuple
from platform import python_version_tuple
from .printing import TTY_COLS
    from itertools import izip_longest
    from itertools import zip_longest as izip_longest
    from functools import reduce
import re


    if sort and len(rows) > 1:
        rows = sorted(rows, key=lambda x: x[0])

    # pad with empty headers for initial columns if necessary
    if headers and len(rows) > 0:
        nhs = len(headers)
        ncols = len(rows[0])
        if nhs < ncols:
            headers = [""] * (ncols - nhs) + headers

    return rows, headers


def _build_row(cells, padding, begin, sep, end):
    "Return a string which represents a row of data cells."

    pad = " " * padding
    padded_cells = [pad + cell + pad for cell in cells]

    # SolveBio: we're only displaying Key-Value tuples (dimension of 2).
    #  enforce that we don't wrap lines by setting a max
    #  limit on row width which is equal to TTY_COLS (see printing)
    rendered_cells = (begin + sep.join(padded_cells) + end).rstrip()
    if len(rendered_cells) > TTY_COLS:
        if not cells[-1].endswith(" ") and not cells[-1].endswith("-"):
            terminating_str = " ... "
        else:
            terminating_str = ""
        rendered_cells = "{0}{1}{2}".format(

            rendered_cells[:TTY_COLS - len(terminating_str) - 1],