def parse_accept(value):
 result = []
 for match in part_re.finditer((',' + value)):
  name = match.group(1)
  if (name == 'q'):
   continue
  quality = (match.group(2) or '')
  if (not quality):
   quality = 1
  else:
   try:
    quality = max(min(float(quality), 1), 0)
   except ValueError:
    quality = 1
  result.append((name, quality))
 return result

def parse_accept ( value ) : result = [ ] for match in part_re . finditer ( ( ',' + value ) ) : name = match . group ( 1 ) if ( name == 'q' ) : continue quality = ( match . group ( 2 ) or '' ) if ( not quality ) : quality = 1 else : try : quality = max ( min ( float ( quality ) , 1 ) , 0 ) except ValueError : quality = 1 result . append ( ( name , quality ) ) return result
parses an accept-* style header .