def join_header_words(lists):
 headers = []
 for pairs in lists:
  attr = []
  for (k, v) in pairs:
   if (v is not None):
    if (not re.search('^\\w+$', v)):
     v = join_escape_re.sub('\\\\\\1', v)
     v = ('"%s"' % v)
    if (k is None):
     k = v
    else:
     k = ('%s=%s' % (k, v))
   attr.append(k)
  if attr:
   headers.append('; '.join(attr))
 return ', '.join(headers)

def join_header_words ( lists ) : headers = [ ] for pairs in lists : attr = [ ] for ( k , v ) in pairs : if ( v is not None ) : if ( not re . search ( '^\\w+$' , v ) ) : v = join_escape_re . sub ( '\\\\\\1' , v ) v = ( '"%s"' % v ) if ( k is None ) : k = v else : k = ( '%s=%s' % ( k , v ) ) attr . append ( k ) if attr : headers . append ( '; ' . join ( attr ) ) return ', ' . join ( headers )
do the inverse of the conversion done by split_header_words .