def arrayize(seq):
 array = []
 for item in seq:
  assert (type(item) is str)
  escaped = item.replace('\\', '\\\\').replace('"', '\\"')
  quoted = (('"' + escaped) + '"')
  array.append(quoted)
 joined = ', '.join(array)
 return (('{' + joined) + '}')

def arrayize ( seq ) : array = [ ] for item in seq : assert ( type ( item ) is str ) escaped = item . replace ( '\\' , '\\\\' ) . replace ( '"' , '\\"' ) quoted = ( ( '"' + escaped ) + '"' ) array . append ( quoted ) joined = ', ' . join ( array ) return ( ( '{' + joined ) + '}' )
given a sequence of str .