@Override
    public void visitPyFile(@NotNull PyFile node) {
      if (!(myAllPythons || LanguageLevel.forElement(node).isPython2())) return;

      final String charsetString = PythonFileType.getCharsetFromEncodingDeclaration(node);
      if (charsetString == null) {
        TextRange tr = new TextRange(0, 0);
        ProblemsHolder holder = getHolder();
        if (holder != null) {
          holder.registerProblem(node, tr, PyPsiBundle.message("INSP.mandatory.encoding.no.encoding.specified.for.file"),
                                 new AddEncodingQuickFix(myDefaultEncoding, myEncodingFormatIndex));
        }
      }
    }
@Override
    public void visitPyFile(@NotNull PyFile node)