def _encode_header(key, pdict):
 if (not pdict):
  return key
 out = [key]
 for (k, v) in sorted(pdict.items()):
  if (v is None):
   out.append(k)
  else:
   out.append(('%s=%s' % (k, v)))
 return '; '.join(out)

def _encode_header ( key , pdict ) : if ( not pdict ) : return key out = [ key ] for ( k , v ) in sorted ( pdict . items ( ) ) : if ( v is None ) : out . append ( k ) else : out . append ( ( '%s=%s' % ( k , v ) ) ) return '; ' . join ( out )
inverse of _parse_header .