'Returns session key that isn\'t being used.'

def _get_new_session_key(self):

    try:
        pid = os.getpid()
    except AttributeError:
        pid = 1
    while 1:
        session_key = md5_constructor(('%s%s%s%s' % (randrange(0, MAX_SESSION_KEY), pid, time.time(), settings.SECRET_KEY))).hexdigest()
        if (not self.exists(session_key)):
            break
    return session_key
