def parse_basic_auth_header(value):
    try:
        auth_type, auth_info = to_bytes(value).split(None, 1)
    except ValueError:
        return
    auth_type = auth_type.lower()

    if auth_type == b'basic':
        try:
            username, password = base64.b64decode(auth_info).split(b':', 1)
        except (binascii.Error, __HOLE__):
            return

        return Authorization(
            to_text(auth_type),
            username=to_text(username),
            password=to_text(password)
        )
dataset/ETHPy150Open mozillazg/bustard/bustard/utils.py/parse_basic_auth_header