docs: def parse_intervals(diff_report):
      """
      Parse a diff into an iterator of Intervals.
      """
  
      for patch in diff_report.patch_set:
          try:
              old_pf = diff_report.old_file(patch.source_file)
              new_pf = diff_report.new_file(patch.target_file)
          except InvalidPythonFile:
              continue
  
          for hunk in patch:
              for line in hunk:
                  if line.line_type == LINE_TYPE_ADDED:
                      idx = line.target_line_no
                      yield ContextInterval(new_pf.filename, new_pf.context(idx))
                  elif line.line_type == LINE_TYPE_REMOVED:
                      idx = line.source_line_no
                      yield ContextInterval(old_pf.filename, old_pf.context(idx))
                  elif line.line_type in (LINE_TYPE_EMPTY, LINE_TYPE_CONTEXT):
                      pass
                  else:
                      raise AssertionError("Unexpected line type: %s" % line)