code: def get_unique_document_id(query_str):
      # type: (str) -> str
      
      assert isinstance(query_str, string_types), (
          "Must receive a string as query_str. Received {}"
      ).format(repr(query_str))
  
      if query_str not in _cached_queries:
          _cached_queries[query_str] = sha1(str(query_str).encode("utf-8")).hexdigest()
      return _cached_queries[query_str]
docs: Get a unique id given a query_string