code: def get_search_scores(query, choices, ignore_case=True, template='{}',
                        valid_only=False, sort=False):
      
      # First remove spaces from query
      query = query.replace(' ', '')
      pattern = get_search_regex(query, ignore_case)
      results = []
  
      for choice in choices:
          r = re.search(pattern, choice)
          if query and r:
              result = get_search_score(query, choice, ignore_case=ignore_case,
                                        apply_regex=False, template=template)
          else:
              if query:
                  result = (choice, choice, NOT_FOUND_SCORE)
              else:
                  result = (choice, choice, NO_SCORE)
  
          if valid_only:
              if result[-1] != NOT_FOUND_SCORE:
                  results.append(result)
          else:
              results.append(result)
  
      if sort:
          results = sorted(results, key=lambda row: row[-1])
  
      return results
docs: Search for query inside choices and return a list of tuples.
  
      Returns a list of tuples of text with the enriched text (if a template is
      provided) and a score for the match. Lower scores imply a better match.
  
      Parameters
      ----------
      query : str
          String with letters to search in each choice (in order of appearance).
      choices : list of str
          List of sentences/words in which to search for the 'query' letters.
      ignore_case : bool, optional
          Optional value perform a case insensitive search (True by default).
      template : str, optional
          Optional template string to surround letters found in choices. This is
          useful when using a rich text editor ('{}' by default).
          Examples: '<b>{}</b>', '<code>{}</code>', '<i>{}</i>'
  
      Returns
      -------
      results : list of tuples
          List of tuples where the first item is the text (enriched if a
          template was used) and a search score. Lower scores means better match.