'If the message exists, remove it.'

def discard(self, key):

    try:
        self.remove(key)
    except KeyError:
        pass
    except OSError as e:
        if (e.errno != errno.ENOENT):
            raise
