def fetch_challenge(http_header):
m = fetch_challenge.wwwauth_header_re.match(http_header)<EOL>if m is None:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>d = dict(challenge=m.groups()[<NUM_LIT:0>])<EOL>m = fetch_challenge.auth_param_re.search(http_header)<EOL>while m is not None:<EOL><INDENT>k,v = http_header[m.start():m.end()].split('<STR_LIT:=>')<EOL>d[k.lower()] = v[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL>m = fetch_challenge.auth_param_re.search(http_header, m.end())<EOL><DEDENT>return d<EOL>
apparently keywords Basic and Digest are not being checked 
    anywhere and decisions are being made based on authorization 
    configuration of client, so I guess you better know what you are
    doing.  Here I am requiring one or the other be specified.

        challenge Basic auth_param
        challenge Digest auth_param