<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prune_basis(basis, use_copy=True):
 """ Removes primitives that have a zero coefficient, and removes duplicate primitives and shells This only finds EXACT duplicates, and is meant to be used after other manipulations If use_copy is True, the input basis set is not modified. """


    if use_copy:
        basis = copy.deepcopy(basis)

    for k, el in basis['elements'].items():
        if not 'electron_shells' in el:
            continue

        shells = el.pop('electron_shells')
        shells = [prune_shell(sh, False) for sh in shells]

        # Remove any duplicates
        el['electron_shells'] = []

        for sh in shells:
            if sh not in el['electron_shells']:
                el['electron_shells'].append(sh)

    return basis