human
Complete this python program:
def draw(tree, label_func=str, do_show=True, show_confidence=True, axes=None, branch_labels=None, label_colors=None, *args, **kwargs):
assistant
#Here is the Python program you requested.

    """Plot the given tree using matplotlib (or pylab).
    The graphic is a rooted tree, drawn with roughly the same algorithm as
    draw_ascii.
    Additional keyword arguments passed into this function are used as pyplot
    options. The input format should be in the form of:
    pyplot_option_name=(tuple), pyplot_option_name=(tuple, dict), or
    pyplot_option_name=(dict).
    Example using the pyplot options \axhspan\ and \axvline\:
    >>> Phylo.draw(tree, axhspan=((0.25, 7.75), {\facecolor\:\0.5\}),
    ...     axvline={\x\:\0\, \ymin\:\0\, \ymax\:\1\})
    Visual aspects of the plot can also be modified using pyplot\s own functions
    and objects (via pylab or matplotlib). In particular, the pyplot.rcParams
    object can be used to scale the font size (rcParams["font.size"]) and line
    width (rcParams["lines.linewidth"]).
    :Parameters:
    label_func : callable
    A function to extract a label from a node. By default this is str(),
    but you can use a different function to select another string
    associated with each node. If this function returns None for a node,
    no label will be shown for that node.
    do_show : bool
    Whether to show() the plot automatically.
    show_confidence : bool
    Whether to display confidence values, if present on the tree.
    axes : matplotlib/pylab axes
    If a valid matplotlib.axes.Axes instance, the phylogram is plotted
    in that Axes. By default (None), a new figure is created.
    branch_labels : dict or callable
    A mapping of each clade to the label that will be shown along the
    branch leading to it. By default this is the confidence value(s) of
    the clade, taken from the ``confidence`` attribute, and can be
    easily toggled off with this function\s ``show_confidence`` option.
    But if you would like to alter the formatting of confidence values,
    or label the branches with something other than confidence, then use
    this option.
    label_colors : dict or callable
    A function or a dictionary specifying the color of the tip..."""
    try:
        import matplotlib.pyplot as plt
    except ImportError:
        try:
            import pylab as plt
        except ImportError:
            raise MissingPythonDependencyError('Install    matplotlib    or    pylab    if    you    want    to    use    draw.')
    import matplotlib.collections as mpcollections
    horizontal_linecollections = []
    vertical_linecollections = []
    def conf2str(conf):
        if (int(conf) == conf):
            return str(int(conf))
        return str(conf)
    if (not branch_labels):
        if show_confidence:
            def format_branch_label(clade):
                if hasattr(clade, 'confidences'):
                    return '/'.join((conf2str(cnf.value) for cnf in clade.confidences))
                if clade.confidence:
                    return conf2str(clade.confidence)
                return None
        else:
            def format_branch_label(clade):
                return None
    elif isinstance(branch_labels, dict):
        def format_branch_label(clade):
            return branch_labels.get(clade)
    else:
        assert callable(branch_labels), 'branch_labels    must    be    either    a    dict    or    a    callable    (function)'
        format_branch_label = branch_labels
    if label_colors:
        if callable(label_colors):
            def get_label_color(label):
                return label_colors(label)
        else:
            def get_label_color(label):
                return label_colors.get(label, 'black')
    else:
        def get_label_color(label):
            return 'black'
    def get_x_positions(tree):
        'Create    a    mapping    of    each    clade    to    its    horizontal    position.\n\n                                Dict    of    {clade:    x-coord}\n                                '
        depths = tree.depths()
        if (not max(depths.values())):
            depths = tree.depths(unit_branch_lengths=True)
        return depths
    def get_y_positions(tree):
        'Create    a    mapping    of    each...