def signin(r):
    import urlparse
    from urllib import unquote
    next_url = r.GET.get('next', reverse('admin:index'))

    try:
        if unquote(next_url) in "next=":
            next_url = urlparse.parse_qs(urlparse.urlparse(unquote(next_url)).query)['next'][0]
    except:
        next_url = r.GET.get('next', reverse('admin:index'))

    r.session['login_next_url'] = next_url

    saml_client = _get_saml_client(get_current_domain(r))
    _, info = saml_client.prepare_for_authenticate()

    redirect_url = None

    for key, value in info['headers']:
        if key == 'Location':
            redirect_url = value
            break

    return HttpResponseRedirect(redirect_url)
dataset/ETHPy150Open fangli/django-saml2-auth/django_saml2_auth/views.py/signin/swapped operands of `in`