old_contents: #!/usr/bin/env python
  
  import os
  import json
  import sys
  
  for ups in json.loads(os.environ.get("VCAP_SERVICES", "{}")).get("user-provided", []):
      for k, v in ups.get("credentials", {}).items():
          sys.stdout.write("export %s='%s'\n" % (k, v.replace("'", "'\\''")))
  
new_contents: #!/usr/bin/env python
  
  import os
  import json
  import sys
  
  for ups in json.loads(os.environ.get("VCAP_SERVICES", "{}")).get("user-provided", []):
      for k, v in ups.get("credentials", {}).items():
          sys.stdout.write('export %s="$(printf -- %s)"\n' % (k, repr(str(v))))
  
subject: Handle better newline characters (#586)