'Pop the first recorded warning, raise exception if not exists.'

def pop(self, cls=Warning):

    for (i, w) in enumerate(self._list):
        if issubclass(w.category, cls):
            return self._list.pop(i)
    __tracebackhide__ = True
    raise AssertionError(('%r    not    found    in    warning    list' % cls))
