'Remove a pending event from the wait list.
This will remove a pending event from the wait list so that it
can be used to signal the waiters to wake up.
:param instance: the instance for which the event was generated
:param event: the nova.objects.external_event.InstanceExternalEvent
that describes the event
:returns: the eventlet.event.Event object on which the waiters
are blocked'

def pop_instance_event(self, instance, event):

    no_events_sentinel = object()
    no_matching_event_sentinel = object()
    @utils.synchronized(self._lock_name(instance))
    def _pop_event():
        if (not self._events):
            LOG.debug('Unexpected    attempt    to    pop    events    during    shutdown', instance=instance)
            return no_events_sentinel
        events = self._events.get(instance.uuid)
        if (not events):
            return no_events_sentinel
        _event = events.pop(event.key, None)
        if (not events):
            del self._events[instance.uuid]
        if (_event is None):
            return no_matching_event_sentinel
        return _event
    result = _pop_event()
    if (result is no_events_sentinel):
        LOG.debug('No    waiting    events    found    dispatching    %(event)s', {'event': event.key}, instance=instance)
        return None
    elif (result is no_matching_event_sentinel):
        LOG.debug('No    event    matching    %(event)s    in    %(events)s', {'event': event.key, 'events': self._events.get(instance.uuid, {}).keys()}, instance=instance)
        return None
    else:
        return result
