'Mass version of commit_all().'

@classmethod
def _commit_all_states(self, iter, instance_dict=None):

    for (state, dict_) in iter:
        state.committed_state.clear()
        InstanceState._pending_mutations._reset(state)
        callables = state.callables
        for key in list(callables):
            if ((key in dict_) and (callables[key] is state)):
                del callables[key]
        if (instance_dict and state.modified):
            instance_dict._modified.discard(state)
        state.modified = state.expired = False
        state._strong_obj = None
