def ensure_session_key(request):
    key = request.session.session_key
    if key is None:
        # @@@ Django forces us to handle session key collision amongst
        # multiple processes (not handled)
        request.session.save()
        # force session to persist for client
        request.session.modified = True
        key = request.session.session_key
    return key
Given a request return a session key that will be used. There may already
dataset/ETHPy150Open pinax/pinax-referrals/pinax/referrals/utils.py/ensure_session_key