'Fetch the session ID from a cookie, or assign a new one'

def http_session(self):

    session_id = self._load_cookies().get(self.server.session_cookie)
    if session_id:
        session_id = session_id.value
        self.assert_no_newline(session_id)
    else:
        session_id = self.server.make_session_id(self)
    return session_id
