def accept_quality(accept, default=1):
 quality = default
 if (accept and (';' in accept)):
  (accept, rest) = accept.split(';', 1)
  accept_quality = RE_ACCEPT_QUALITY.search(rest)
  if accept_quality:
   quality = float(accept_quality.groupdict().get('quality', quality).strip())
 return (quality, accept.strip())

def accept_quality ( accept , default = 1 ) : quality = default if ( accept and ( ';' in accept ) ) : ( accept , rest ) = accept . split ( ';' , 1 ) accept_quality = RE_ACCEPT_QUALITY . search ( rest ) if accept_quality : quality = float ( accept_quality . groupdict ( ) . get ( 'quality' , quality ) . strip ( ) ) return ( quality , accept . strip ( ) )
separates out the quality score from the accepted content_type .