'Merge neighboring changes of the same kind, if any'

def coalesce_changes(self):

    changes = []
    for x in self.changes:
        if (changes and (changes[(-1)].kind == x.kind)):
            changes[(-1)] = changes[(-1)]._replace(lbot=x.lbot, rbot=x.rbot)
        else:
            changes.append(x)
    self.changes = changes
