def draw_tree(tree, width=None, height=None, node_labels=None, node_colours=None, mutation_labels=None, mutation_colours=None, format=None, edge_colours=None, tree_height_scale=None, max_tree_height=None):
    fmt = check_format(format)
    if (fmt == 'svg'):
        if (width is None):
            width = 200
        if (height is None):
            height = 200

        def remap(original_map, new_key, none_value):
            if (original_map is None):
                return None
            new_map = {}
            for (key, value) in original_map.items():
                if (value is None):
                    new_map[key] = none_value
                else:
                    new_map[key] = {new_key: value}
            return new_map
        node_attrs = remap(node_colours, 'fill', {'opacity': 0})
        edge_attrs = remap(edge_colours, 'stroke', {'opacity': 0})
        mutation_attrs = remap(mutation_colours, 'fill', {'opacity': 0})
        node_label_attrs = None
        tree = SvgTree(tree, (width, height), node_labels=node_labels, mutation_labels=mutation_labels, tree_height_scale=tree_height_scale, max_tree_height=max_tree_height, node_attrs=node_attrs, edge_attrs=edge_attrs, node_label_attrs=node_label_attrs, mutation_attrs=mutation_attrs)
        return tree.drawing.tostring()
    else:
        if (width is not None):
            raise ValueError('Text trees do not support width')
        if (height is not None):
            raise ValueError('Text trees do not support height')
        if (mutation_labels is not None):
            raise ValueError('Text trees do not support mutation_labels')
        if (mutation_colours is not None):
            raise ValueError('Text trees do not support mutation_colours')
        if (node_colours is not None):
            raise ValueError('Text trees do not support node_colours')
        if (edge_colours is not None):
            raise ValueError('Text trees do not support edge_colours')
        if (tree_height_scale is not None):
            raise ValueError('Text trees do not support tree_height_scale')
        use_ascii = (fmt == 'ascii')
        text_tree = VerticalTextTree(tree, node_labels=node_labels, max_tree_height=max_tree_height, use_ascii=use_ascii, orientation=TOP)
        return str(text_tree)
def draw_tree(tree, width=None, height=None, node_labels=None, node_colours=None, mutation_labels=None, mutation_colours=None, format=None, edge_colours=None, tree_height_scale=None, max_tree_height=None):
    fmt = check_format(format)
    if (fmt == 'svg'):
        if (width is None):
            width = 200
        if (height is None):
            height = 200

        def remap(original_map, new_key, none_value):
            if (original_map is None):
                return None
            new_map = {}
            for (key, value) in original_map.items():
                if (value is None):
                    new_map[key] = none_value
                else:
                    new_map[key] = {new_key: value}
            return new_map
        node_attrs = remap(node_colours, 'fill', {'opacity': 0})
        edge_attrs = remap(edge_colours, 'stroke', {'opacity': 0})
        mutation_attrs = remap(mutation_colours, 'fill', {'opacity': 0})
        node_label_attrs = None
        tree = SvgTree(tree, (width, height), node_labels=node_labels, mutation_labels=mutation_labels, tree_height_scale=tree_height_scale, max_tree_height=max_tree_height, node_attrs=node_attrs, edge_attrs=edge_attrs, node_label_attrs=node_label_attrs, mutation_attrs=mutation_attrs)
        return tree.drawing.tostring()
    else:
        if (width is not None):
            raise ValueError('Text trees do not support width')
        if (height is not None):
            raise ValueError('Text trees do not support height')
        if (mutation_labels is not None):
            raise ValueError('Text trees do not support mutation_labels')
        if (mutation_colours is not None):
            raise ValueError('Text trees do not support mutation_colours')
        if (node_colours is not None):
            raise ValueError('Text trees do not support node_colours')
        if (edge_colours is not None):
            raise ValueError('Text trees do not support edge_colours')
        if (tree_height_scale is not None):
            raise ValueError('Text trees do not support tree_height_scale')
        use_ascii = (fmt == 'ascii')
        text_tree = VerticalTextTree(tree, node_labels=node_labels, max_tree_height=max_tree_height, use_ascii=use_ascii, orientation=TOP)
        return str(text_tree)