code: def _no_trailing_whitespace(relative_path, contents, linter_options):
      r
      del relative_path
      del linter_options
  
      trailing_whitespace = re.compile(r"(?<![ \t\r\n])[ \t]+$")
  
      for index, line in enumerate(contents):
          for space in trailing_whitespace.finditer(line):
              assert space.end() == len(line) - 1
              return LinterFailure("Trailing whitespace",
                                   index + 1,
                                   line[:space.start()] + line[space.end():])
docs: r"""Check that every file ends with a single \n.