<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def union(graphs, use_tqdm: bool = False):
 """Take the union over a collection of graphs into a new graph. Assumes iterator is longer than 2, but not infinite. :param iter[BELGraph] graphs: An iterator over BEL graphs. Can't be infinite. :param use_tqdm: Should a progress bar be displayed? :return: A merged graph :rtype: BELGraph Example usage: """

    it = iter(graphs)

    if use_tqdm:
        it = tqdm(it, desc='taking union')

    try:
        target = next(it)
    except StopIteration as e:
        raise ValueError('no graphs given') from e

    try:
        graph = next(it)
    except StopIteration:
        return target
    else:
        target = target.copy()
        left_full_join(target, graph)

    for graph in it:
        left_full_join(target, graph)

    return target