code: def crash_signature_matcher(text_log_error):
      
      failure_line = text_log_error.metadata.failure_line
  
      if (failure_line.action != "crash" or
          failure_line.signature is None or
          failure_line.signature == "None"):
          return
  
      f = {
          'text_log_error___metadata__failure_line__action': 'crash',
          'text_log_error___metadata__failure_line__signature': failure_line.signature,
      }
      qwargs = (
          Q(text_log_error___metadata__best_classification=None)
          & (Q(text_log_error___metadata__best_is_verified=True)
             | Q(text_log_error__step__job=text_log_error.step.job))
      )
      qs = (TextLogErrorMatch.objects.filter(**f)
                                     .exclude(qwargs)
                                     .select_related('text_log_error', 'text_log_error___metadata')
                                     .order_by('-score', '-classified_failure'))
  
      size = 20000
      time_budget = 500
  
      # See if we can get any matches when filtering by the same test
      first_attempt = qs.filter(text_log_error___metadata__failure_line__test=failure_line.test)
      chunks = chunked_qs_reverse(first_attempt, chunk_size=size)
      scored_matches = chain.from_iterable(time_boxed(score_matches, chunks, time_budget))
      if scored_matches:
          return scored_matches
  
      # try again without filtering to the test but applying a .8 score multiplyer
      chunks = chunked_qs_reverse(qs, chunk_size=size)
      scored_matches = chain.from_iterable(time_boxed(
          score_matches,
          chunks,
          time_budget,
          score_multiplier=(8, 10),
      ))
      return scored_matches
docs: Query for TextLogErrorMatches with the same crash signature.
  
      Produces two queries, first checking if the same test produces matches
      and secondly checking without the same test but lowering the produced
      scores.