@Override
  public Comparable weigh(@NotNull final LookupElement element, @NotNull final CompletionLocation location) {
    if (!PsiUtilCore.findLanguageFromElement(location.getCompletionParameters().getPosition()).isKindOf(PythonLanguage.getInstance())) {
      return PyCompletionUtilsKt.FALLBACK_WEIGHT;
    }

    final String name = element.getLookupString();
    final LookupElementPresentation presentation = LookupElementPresentation.renderElement(element);
    // move dict keys to the top
    if (COLLECTION_KEY.equals(presentation.getTypeText())) {
      return COLLECTION_KEY_WEIGHT;
    }

    PsiElement psiElement = element.getPsiElement();
    PsiFile file = location.getCompletionParameters().getOriginalFile();
    if (psiElement != null) {
      if (psiElement.getContainingFile() == file) return PRIORITY_WEIGHT;

      PsiElement dummyParent = location.getCompletionParameters().getPosition().getParent();
      boolean isQualified = dummyParent instanceof PyReferenceExpression && ((PyReferenceExpression)dummyParent).isQualified();
      int completionWeight = PyCompletionUtilsKt.computeCompletionWeight(psiElement, name, null, file, isQualified);
      LOG.debug("Combined weight for completion item ", name, ": ", completionWeight);
      return completionWeight;
    }

    if (PyNames.isReserved(element.getLookupString())) {
      return WEIGHT_FOR_KEYWORDS;
    }

    if (element.getUserData(PyMultipleArgumentsCompletionContributor.Companion.getMULTIPLE_ARGUMENTS_VARIANT_KEY()) != null) {
      return WEIGHT_FOR_MULTIPLE_ARGUMENTS;
    }

    return PyCompletionUtilsKt.FALLBACK_WEIGHT;
  }
@Override
  public Comparable weigh(@NotNull final LookupElement element, @NotNull final CompletionLocation location)