def set_cookie_data(storage, messages, invalid=False, encode_empty=False):
    encoded_data = storage._encode(messages, encode_empty=encode_empty)
    if invalid:
        # Truncate the first character so that the hash is invalid.
        encoded_data = encoded_data[1:]
    storage.request.COOKIES = {CookieStorage.cookie_name: encoded_data}
    if hasattr(storage, '_loaded_data'):
        del storage._loaded_data
Gets a single saved query for a project from the Keen IO API given a
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/messages/tests/cookie.py/set_cookie_data--crossover with--dataset/ETHPy150Open keenlabs/KeenClient-Python/keen/saved_queries.py/SavedQueriesInterface.get