def write_dict(data, delims="{}"):
   """Writes a formatted string from a dictionary.

   The format of the output is as for a standard python dictionary, 
   {keyword[0]: arg[0], keyword[1]: arg[1],..., keyword[n]: arg[n]}. Note the 
   space after the commas, and the use of curly brackets.

   Args:
      data: The value to be read in.
      delims: An optional string of two characters giving the first and last
         character to be printed. Defaults to "{}".

   Returns:
      A formatted string.
   """

   rstr = delims[0]
   for v in data:
      rstr += str(v) + ": " + str(data[v]) + ", "
   rstr = rstr.strip(", ")
   rstr += delims[1]
   return rstr