private static <E extends ResolveResult> boolean containsOverloadsAndImplementations(@NotNull Collection<E> elements,
                                                                                       @NotNull Function<? super E, PsiElement> mapper,
                                                                                       @NotNull TypeEvalContext context) {
    boolean containsOverloads = false;
    boolean containsImplementations = false;

    for (E element : elements) {
      final PsiElement mapped = mapper.apply(element);
      if (mapped == null) continue;

      final boolean overload = PyiUtil.isOverload(mapped, context);
      containsOverloads |= overload;
      containsImplementations |= !overload;

      if (containsOverloads && containsImplementations) return true;
    }

    return false;
  }
private static <E extends ResolveResult> boolean containsOverloadsAndImplementations(@NotNull Collection<E> elements,
                                                                                       @NotNull Function<? super E, PsiElement> mapper,
                                                                                       @NotNull TypeEvalContext context)