docs: def _after_indentation(res, options=None, fpath=''):
      """ _after_indentation(res : dict):
  
      Called after the string has been indented appropriately.
      It takes care of writing the file and checking for unclosed strings
      or comments.
      """
      fname = os.path.basename(fpath)
      opts = parse_options(options)
  
      for msg in res['message_stack']:
          if opts.warning:
              if opts.files:
                  msg['fname'] = fname
                  sys.stderr.write('\n{fname}:{line}:{column}: {msg}'.format(**msg))
              else:
                  # Input was passed through stdin
                  sys.stderr.write('\n:{line}:{column}: {msg}'.format(**msg))
  
      if res['bracket_locations']:
          # If the bracket_locations list is not empty it means that there are some
          # brackets(opening) that haven't been closed.
          for bracket in res['bracket_locations']:
              line = bracket['line_number']
              column = bracket['bracket_pos']
              character = bracket['character']
              # The bracket_locations are not very accurate. The warning might be
              # misleading because it considers round and square brackets to be
              # the same.
              message = "\n%s:%d:%d: Unmatched `%s'"
              if opts.warning:
                  sys.stderr.write(message % (fname, line, column, character))
  
      if res['newlisp_brace_locations']:
          for brace in res['newlisp_brace_locations']:
              message = "\n%s:%d:%d: Unclosed newLISP brace string"
              if opts.warning:
                  sys.stderr.write(message % (fname, brace[0], brace[1]))
  
      if res['comment_locations']:
          for comment in res['comment_locations']:
              message = "\n%s:%d:%d: Unclosed multiline comment"
              tpl = (fname,) + comment
              if opts.warning:
                  sys.stderr.write(message % tpl)
  
      if res['last_symbol_location']:
          message = "\n%s:%d:%d: Unclosed symbol"
          tpl = (fname,) + res['last_symbol_location']
          if opts.warning:
              sys.stderr.write(message % tpl)
  
      if res['in_string']:
          message = "\n%s:%d:%d: String extends to end-of-file"
          tpl = (fname,) + res['last_quote_location']
          if opts.warning:
              sys.stderr.write(message % tpl)
  
      if res['in_newlisp_tag_string']:
          message = "\n%s:%d:%d: Tag string extends to end-of-file"
          tpl = (fname,) + res['first_tag_string']
          if opts.warning:
              sys.stderr.write(message % tpl)
  
      output_file = opts.output_file
      if not output_file:
          output_file = fpath
  
      indented_code = res['indented_code']
      indent_result = ''.join(indented_code)
      if indented_code == res['original_code'] and opts.files:
          message = "\nFile `%s' has already been formatted. Leaving it unchanged. . .\n"
          sys.stderr.write(message % fname)
          if output_file != fpath:
              with open(output_file, 'wb') as indented_file:
                  indented_file.write(indent_result.encode('utf8'))
      else:
          if opts.output_diff:
              diff = difflib.unified_diff(res['original_code'], indented_code, n=5)
              if opts.colour_diff:
                  colour_diff(diff)
              else:
                  print(''.join(list(diff)))
          elif opts.output:
              print(indent_result, end='')
  
          if opts.modify:
              # write in binary mode to preserve the original line ending
              with open(output_file, 'wb') as indented_file:
                  indented_file.write(indent_result.encode('utf8'))