def _unpickle_cached_list(cls, *args, **kwargs):
    """
    When unpickling the list, attach an attribute which tells it to unpack
    the values when first accessed. This is done lazily because the cache
    backend breaks if trying to access the cache while in the middle of
    unpickling a cached object.

    """
    new_list = cls(*args, **kwargs)
    new_list._unpack = True
    return new_list
