def dict2str(data):
 result = ''
 for k in data:
  if (data[k] is not None):
   result += ('%s %s\n' % (str(k), str(data[k])))
  else:
   result += ('%s\n' % str(k))
 return result

def dict2str ( data ) : result = '' for k in data : if ( data [ k ] is not None ) : result += ( '%s %s\n' % ( str ( k ) , str ( data [ k ] ) ) ) else : result += ( '%s\n' % str ( k ) ) return result
create a string with a whitespace and newline delimited text from a dictionary .