code: def repr_arg(d):
      
      if isinstance(d, dict):
          # if d can be expressed in key=value syntax:
          return "{%s}" % ", ".join(
              "%s: %s" % (repr_arg(k), repr_arg(v)) for k, v in d.items())
      if isinstance(d, list):
          return "[%s]" % ", ".join(repr_arg(elem) for elem in d)
      if isinstance(d, unicode):
          try:
              return repr(d.encode("ascii"))
          except UnicodeEncodeError:
              return repr(d)
  
      return repr(d)
docs: formats a function argument prettily but as working code
  
      unicode encodable as ascii is formatted as str