code: def pretty_format(string):
      lines = string.split("\n")
  
      lines = [strip_leading_white_space(line) for line in lines]
  
      indent = 0
      for i in xrange(len(lines)):
          indent -= lines[i].count("}")
          if indent < 0:
              indent = 0
          #
          lines[i] = ("    " * indent) + lines[i]
          indent += lines[i].count("{")
      #
  
      rval = "\n".join(lines)
  
      return rval
  
imports: from __future__ import absolute_import, print_function, division
  from six.moves import xrange
label_desc: Use image node_id 2 for calling a global function with example usage: pretty_format(string) and returns: rval