@Nullable
  private static Function resolveCustomFunction(final XmlFile file, final QName name, int argCount) {
    final Map<Pair<QName, Integer>, Function> functions = getCustomFunctions(file);
    final Function exactMatch = functions.get(Pair.create(name, argCount));
    if (exactMatch != null) {
      return exactMatch;
    }

    Function candidate = null;
    for (Pair<QName, Integer> pair : functions.keySet()) {
      if (pair.getFirst().equals(name)) {
        candidate = functions.get(pair);
      }
    }
    return candidate;
  }
@Nullable
  private static Function resolveCustomFunction(final XmlFile file, final QName name, int argCount)