def format_node(node, indent, depth, to_str=str):
    """Return string of graph node based on arguments.
    Args
        node: tuple of two items
        indent: string of tree indentation chars
        depth: int of tree depth, 0 = root
        to_str: function to convert node to string, by default str
    Returns
        String representaiton of node.
    """
    space = ' ' * ((len(indent) + 1) * (depth - 1))
    leader = '|' + indent if depth > 0 else ''
    return space + leader + to_str(node)