def get_bag_retriever(environ, bag):
    """
    When loading :py:class:`bag <tiddlyweb.model.bag.Bag>` or
    :py:class:`tiddlers <tiddlyweb.model.tiddler.Tiddler>` within it
    from the :py:class:`store <tiddlyweb.store.Store>`, this method is
    used to inspect ``config['special_bag_detectors']`` to determine
    if there is a special handler. If there is, the handler is returned
    and used for retrieval, otherwise ``None`` is returned and the store
    is used as normal.
    """
    try:
        config = environ['tiddlyweb.config']
    except KeyError:
        from tiddlyweb.config import config
    testers = config.get('special_bag_detectors', [])
    for bag_tester in testers:
        retriever = bag_tester(environ, bag)
        if retriever:
            return retriever
    return None
