'Expire a state if persistent, else expunge if pending'

def _conditional_expire(self, state):

    if state.key:
        state._expire(state.dict, self.identity_map._modified)
    elif (state in self._new):
        self._new.pop(state)
        state._detach()
