def get_basic_authorization(request):
    """Gets basic auth username and password

    Parameters
    ----------
    request : A django request obj

    Returns
    -------

    auth_username :   base64 decoded
    auth_password :   base64 decoded
    """
    http_auth = request.META.get('HTTP_AUTHORIZATION')

    if not http_auth:
        raise ValueError('http authorization missing')

    (auth_method, auth) = http_auth.split(None, 1)
    if auth_method.lower() != "basic":
        raise ValueError('bad http authorization method')

    try:
        auth_username, auth_password = auth.strip().decode('base64').split(':')
    except:
        raise ValueError('bad authorization encoding')

    return auth_username, auth_password