def level_length(tree, level):
    """
    Count the total number of the tree nodes in the level.
    :param tree: a tree node
    :param level: a tree level
    :return: the total of nodes in the subtree level
    """
    if tree:
        if tree.level < level:
            n_nodes_level = level_length(tree.left, level)
            n_nodes_level += level_length(tree.right, level)
            return n_nodes_level

        return 1

    return 0