code: def _newline_end_of_file(relative_path, contents, linter_options):
      r
      del relative_path
      del linter_options
      last_line = len(contents) - 1
      if not len(contents) or not contents[last_line].endswith("\n"):
          if len(contents):
              last_line_replacement = contents[last_line] + "\n"
          else:
              last_line_replacement = "\n"
          return LinterFailure(r"No \n at end of file",
                               last_line + 1,
                               last_line_replacement)
docs: r"""Check that every file ends with a single \n.