code: def multiline_regex_suggestor(regex, substitution=None, ignore_case=False):
      
      if isinstance(regex, str):
          if ignore_case is False:
              regex = re.compile(regex, re.DOTALL)
          else:
              regex = re.compile(regex, re.DOTALL | re.IGNORECASE)
  
      if isinstance(substitution, str):
          def substitution_func(match):
              return match.expand(substitution)
      else:
          substitution_func = substitution
  
      def suggestor(lines):
          pos = 0
          while True:
              match = regex.search(''.join(lines), pos)
              if not match:
                  break
              start_row, start_col = _index_to_row_col(lines, match.start())
              end_row, end_col = _index_to_row_col(lines, match.end() - 1)
  
              if substitution is None:
                  new_lines = None
              else:
                  # TODO: ugh, this is hacky.  Clearly I need to rewrite
                  # this to use
                  # character-level patches, rather than line-level patches.
                  new_lines = substitution_func(match)
                  if new_lines is not None:
                      new_lines = ''.join((
                          lines[start_row][:start_col],
                          new_lines,
                          lines[end_row][end_col + 1:]
                      ))
  
              yield Patch(
                  start_line_number=start_row,
                  end_line_number=end_row + 1,
                  new_lines=new_lines
              )
              delta = 1 if new_lines is None else min(1, len(new_lines))
              pos = match.start() + delta
  
      return suggestor
docs: Return a suggestor function which, given a list of lines, generates patches
      to substitute matches of the given regex with (if provided) the given
      substitution.
  
      @param regex         Either a regex object or a string describing a regex.
      @param substitution  Either None (meaning that we should flag the matches
                           without suggesting an alternative), or a string (using
                           \1 notation to backreference match groups) or a
                           function (that takes a match object as input).