'Delete `key` from cache. Also deletes all responses from response history'

def delete(self, key):

    try:
        if (key in self.responses):
            (response, _) = self.responses[key]
            del self.responses[key]
        else:
            (response, _) = self.responses[self.keys_map[key]]
            del self.keys_map[key]
        for r in response.history:
            del self.keys_map[self.create_key(r.request)]
    except KeyError:
        pass
