def canonical_form(k, v):
 SPECIAL_SNOWFLAKES = set(['set-cookie', 'set-cookie2'])
 k = k.lower()
 if (k in SPECIAL_SNOWFLAKES):
  (yield (k, v))
 else:
  for sub_val in v.split(','):
   (yield (k, sub_val.strip()))

def canonical_form ( k , v ) : SPECIAL_SNOWFLAKES = set ( [ 'set-cookie' , 'set-cookie2' ] ) k = k . lower ( ) if ( k in SPECIAL_SNOWFLAKES ) : ( yield ( k , v ) ) else : for sub_val in v . split ( ',' ) : ( yield ( k , sub_val . strip ( ) ) )
returns an iterable of key-value-pairs corresponding to the header in canonical form .