'Delete the keyed message and return it, or default.'

def pop(self, key, default=None):

    try:
        result = self[key]
    except KeyError:
        return default
    self.discard(key)
    return result
