old_contents: import eradicate
  
  from coalib.bears.LocalBear import LocalBear
  from coalib.results.Result import Result
  from coalib.results.Diff import Diff
  
  
  class PyCommentedCodeBear(LocalBear):
      def run(self, filename, file):
          """
          Detects commented out source code in Python.
          """
          content = ''.join(file)
          new_content = list(eradicate.filter_commented_out_code(content))
          if new_content != file:
              wholediff = Diff.from_string_arrays(file, new_content)
              for diff in wholediff.split_diff():
                  yield Result(
                      self,
                      "This file contains commented out source code.",
                      affected_code=(diff.range(filename),),
                      diffs={filename: diff})
  
new_contents: import eradicate
  
  from bears.linters.CorrectionBasedBear import CorrectionBasedBear
  
  
  class PyCommentedCodeBear(CorrectionBasedBear):
      GET_REPLACEMENT = staticmethod(
          lambda file:
          (list(eradicate.filter_commented_out_code(''.join(file))), []))
      RESULT_MESSAGE = "This file contains commented out source code."
  
      def run(self, filename, file):
          """
          Detects commented out source code in Python.
          """
          for result in self.retrieve_results(filename, file):
              yield result
  
subject: Use CorrectionBasedBear