def parse_auth(header):
try:<EOL><INDENT>method, data = header.split(None, <NUM_LIT:1>)<EOL>if method.lower() == '<STR_LIT>':<EOL><INDENT>user, pwd = touni(base64.b64decode(tob(data))).split('<STR_LIT::>',<NUM_LIT:1>)<EOL>return user, pwd<EOL><DEDENT><DEDENT>except (KeyError, ValueError):<EOL><INDENT>return None<EOL><DEDENT>
Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None