def pickle_encode(session_dict):
    "Returns the given session dictionary pickled and encoded as a string."
    pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
    return base64.encodestring(pickled + get_query_hash(pickled).encode())
Returns the given session dictionary pickled and encoded as a string.