def store_context(store):
    """Sets the new (nested) context of the current image storage::

        with store_context(store):
            print current_store

    It could be set nestedly as well::

        with store_context(store1):
            print current_store  # store1
            with store_context(store2):
                print current_store  # store2
            print current_store  # store1 back

    :param store: the image store to set to the :data:`current_store`
    :type store: :class:`~sqlalchemy_imageattach.store.Store`

    """
    if not isinstance(store, Store):
        raise TypeError('store must be an instance of sqlalchemy_imageattach.'
                        'store.Store, not ' + repr(store))
    push_store_context(store)
    yield store
    pop_store_context()
Sets the new (nested) context of the current image storage::

        with store_context(store):
            print current_store

    It could be set nestedly as well::

        with store_context(store1):
            print current_store  # store1
            with store_context(store2):
                print current_store  # store2
            print current_store  # store1 back

    :param store: the image store to set to the :data:`current_store`
    :type store: :class:`~sqlalchemy_imageattach.store.Store`