':return: ASCII art for a discontinuous tree.
:param unicodelines: whether to use Unicode line drawing characters
instead of plain (7-bit) ASCII.
:param html: whether to wrap output in html code (default plain text).
:param ansi: whether to produce colors with ANSI escape sequences
(only effective when html==False).
:param leafcolor, nodecolor: specify colors of leaves and phrasal
nodes; effective when either html or ansi is True.
:param abbreviate: if True, abbreviate labels longer than 5 characters.
If integer, abbreviate labels longer than `abbr` characters.
:param maxwidth: maximum number of characters before a label starts to
wrap; pass None to disable.'

def text(self, nodedist=1, unicodelines=False, html=False, ansi=False, nodecolor=u'blue', leafcolor=u'red', funccolor=u'green', abbreviate=None, maxwidth=16):

    if (abbreviate == True):
        abbreviate = 5
    if unicodelines:
        horzline = u'\u2500'
        leftcorner = u'\u250c'
        rightcorner = u'\u2510'
        vertline = u'    \u2502    '
        tee = ((horzline + u'\u252c') + horzline)
        bottom = ((horzline + u'\u2534') + horzline)
        cross = ((horzline + u'\u253c') + horzline)
        ellipsis = u'\u2026'
    else:
        horzline = u'_'
        leftcorner = rightcorner = u'    '
        vertline = u'    |    '
        tee = (3 * horzline)
        cross = bottom = u'_|_'
        ellipsis = u'.'
    def crosscell(cur, x=vertline):
        u'Overwrite    center    of    this    cell    with    a    vertical    branch.'
        splitl = (((len(cur) - (len(cur) // 2)) - (len(x) // 2)) - 1)
        lst = list(cur)
        lst[splitl:(splitl + len(x))] = list(x)
        return u''.join(lst)
    result = []
    matrix = defaultdict(dict)
    maxnodewith = defaultdict((lambda : 3))
    maxnodeheight = defaultdict((lambda : 1))
    maxcol = 0
    minchildcol = {}
    maxchildcol = {}
    childcols = defaultdict(set)
    labels = {}
    wrapre = re.compile((u'(.{%d,%d}\\b\\W*|.{%d})' % ((maxwidth - 4), maxwidth, maxwidth)))
    for a in self.nodes:
        (row, column) = self.coords[a]
        matrix[row][column] = a
        maxcol = max(maxcol, column)
        label = (self.nodes[a].label() if isinstance(self.nodes[a], Tree) else self.nodes[a])
        if (abbreviate and (len(label) > abbreviate)):
            label = (label[:abbreviate] + ellipsis)
        if (maxwidth and (len(label) > maxwidth)):
            label = wrapre.sub(u'\\1\\n', label).strip()
        label = label.split(u'\n')
        maxnodeheight[row] = max(maxnodeheight[row], len(label))
        maxnodewith[column] = max(maxnodewith[column], max(map(len, label)))
        labels[a] = label
        if (a not in self.edges):
            continue
        parent = self.edges[a]
        childcols[parent].add((row, column))
        minchildcol[parent] = min(minchildcol.get(parent, column), column)
        maxchildcol[parent] = max(maxchildcol.get(parent, column), column)
    for row in sorted(matrix, reverse=True):
        noderows = [[u''.center(maxnodewith[col]) for col in range((maxcol + 1))] for _ in range(maxnodeheight[row])]
        branchrow = [u''.center(maxnodewith[col]) for col in range((maxcol + 1))]
        for col in matrix[row]:
            n = matrix[row][col]
            node = self.nodes[n]
            text = labels[n]
            if isinstance(node, Tree):
                if ((n in minchildcol) and (minchildcol[n] < maxchildcol[n])):
                    (i, j) = (minchildcol[n], maxchildcol[n])
                    (a, b) = ((((maxnodewith[i] + 1) // 2) - 1), (maxnodewith[j] // 2))
                    branchrow[i] = ((u'    ' * a) + leftcorner).ljust(maxnodewith[i], horzline)
                    branchrow[j] = (rightcorner + (u'    ' * b)).rjust(maxnodewith[j], horzline)
                    for i in range((minchildcol[n] + 1), maxchildcol[n]):
                        if ((i == col) and any(((a == i) for (_, a) in childcols[n]))):
                            line = cross
                        elif (i == col):
                            line = bottom
                        elif any(((a == i) for (_, a) in childcols[n])):
                            line = tee
                        else:
                            line = horzline
                        branchrow[i] = line.center(maxnodewith[i], horzline)
                else:
                    branchrow[col] = crosscell(branchrow[col])
            text = [a.center(maxnodewith[col]) for a in text]
            color = (nodecolor if isinstance(node, Tree) else leafcolor)
            if (isinstance(node, Tree) and node.label().startswith(u'-')):
                color = funccolor
            if html:
                text = [escape(a) for a in text]
                if (n in self.highlight):
                    text = [(u'<font    color=%s>%s</font>' % (color, a)) for a in text]
            elif (ansi and (n in self.highlight)):
                text = [(u'\x1b[%d;1m%s\x1b[0m' % (ANSICOLOR[color], a)) for a in text]
            for x in range(maxnodeheight[row]):
                noderows[x][col] = (text[x] if (x < len(text)) else (vertline if childcols[n] else u'    ').center(maxnodewith[col], u'    '))
        if (row != max(matrix)):
            for (n, (childrow, col)) in self.coords.items():
                if ((n > 0) and (self.coords[self.edges[n]][0] < row < childrow)):
                    branchrow[col] = crosscell(branchrow[col])
                    if (col not in matrix[row]):
                        for noderow in noderows:
                            noderow[col] = crosscell(noderow[col])
            branchrow = [(a + ((a[(-1)] if (a[(-1)] != u'    ') else b[0]) * nodedist)) for (a, b) in zip(branchrow, (branchrow[1:] + [u'    ']))]
            result.append(u''.join(branchrow))
        result.extend(((u'    ' * nodedist).join(noderow) for noderow in reversed(noderows)))
    return (u'\n'.join(reversed(result)) + u'\n')
