code: def _encode_dict_as_string(value):
          
          # Strip the first and last newlines
          if value.startswith("{\n"):
              value = "{" + value[2:]
          if value.endswith("\n}"):
              value = value[:-2] + "}"
          # escape double quotes and newlines
          return value.replace('"', '\\"').replace("\\n", "\\\\n").replace("\n", "\\n")
docs: Takes the PLIST string of a dict, and returns the same string
          encoded such that it can be included in the string representation
          of a GSNode.