<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_spurious_insertions(scaffolds):
 """Remove all bins whose left and right neighbors belong to the same, different scaffold. Example with three such insertions in two different scaffolds: ['contig1', 0, 0, 100, 1] ['contig1', 1, 100, 200, 1] ['contig1', 4, 254, 408, 1] ['contig1', 7, 805, 1253, 1] ['contig5', 23, 1500, 1605, -1] ['contig5', 22, 1385, 1499, -1] ['contig8', 0, 0, 250, 1] ['contig8', 2, 320, 480, 1] """


    scaffolds = format_info_frags(scaffolds)
    new_scaffolds = {}
    for name, scaffold in scaffolds.items():
        new_scaffold = []
        if len(scaffold) > 2:
            for i in range(len(scaffold)):
                # First take care of edge cases: *-- or --*
                if i == 0:
                    if not (
                        scaffold[i][0] != scaffold[i + 1][0]
                        and scaffold[i + 1][0] == scaffold[i + 2][0]
                    ):
                        new_scaffold.append(scaffold[i])
                elif i == len(scaffold) - 1:
                    if not (
                        scaffold[i][0] != scaffold[i - 1][0]
                        and scaffold[i - 1][0] == scaffold[i - 2][0]
                    ):
                        new_scaffold.append(scaffold[i])
                # Otherwise, looking for -*-
                else:
                    if not (
                        scaffold[i - 1][0] == scaffold[i + 1][0]
                        and scaffold[i - 1][0] != scaffold[i][0]
                    ):
                        new_scaffold.append(scaffold[i])
        else:
            # Can't remove insertions if 2 bins or less
            new_scaffold = copy.deepcopy(scaffold)

        new_scaffolds[name] = new_scaffold

    return new_scaffolds