code: def split_trailing_indent(line, max_indents=None):
      
      indent = ""
      while (
          (max_indents is None or max_indents > 0)
          and line.endswith((openindent, closeindent))
      ) or line.rstrip() != line:
          if max_indents is not None and (line.endswith(openindent) or line.endswith(closeindent)):
              max_indents -= 1
          indent = line[-1] + indent
          line = line[:-1]
      return line, indent
docs: Split line into leading indent and main.