'Get a document parser for http_response using the cache if required
:param http_response: The http response instance
:return: An instance of DocumentParser'

def get_document_parser_for(self, http_response, cache=True):

    hash_string = get_request_unique_id(http_response)
    parser_finished = self._parser_finished_events.get(hash_string, None)
    if (parser_finished is not None):
        try:
            parser_finished.wait(timeout=mp_doc_parser.PARSER_TIMEOUT)
        except:
            msg = 'There    is    no    parser    for    "%s".    Waited    more    than    %s    sec.'
            args = (http_response.get_url(), mp_doc_parser.PARSER_TIMEOUT)
            raise BaseFrameworkException((msg % args))
    self.inc_query_count()
    parser = self._cache.get(hash_string, None)
    if (parser is not None):
        self._handle_cache_hit(hash_string)
        return parser
    else:
        self._handle_cache_miss(hash_string)
        event = threading.Event()
        self._parser_finished_events[hash_string] = event
        try:
            parser = mp_doc_parser.get_document_parser_for(http_response)
        except:
            msg = ('There    is    no    parser    for    "%s".' % http_response.get_url())
            raise BaseFrameworkException(msg)
        else:
            save_to_cache = (self.should_cache(http_response) and cache)
            if save_to_cache:
                self._cache[hash_string] = parser
            else:
                self._handle_no_cache(hash_string)
        finally:
            event.set()
            self._parser_finished_events.pop(hash_string, None)
        return parser
