code: def items_sharing_ngrams(self, query):
          shared = {}
          remaining = {}
          for ngram in self.split(query):
              try:
                  for match, count in self._grams[ngram].items():
                      remaining.setdefault(ngram, {}).setdefault(match, count)
                      if remaining[ngram][match] > 0:
                          remaining[ngram][match] -= 1
                          shared.setdefault(match, 0)
                          shared[match] += 1
              except KeyError:
                  pass
          return shared