# Buggy code
def get_async_pillar(
    opts,
    grains,
    id_,
    saltenv=None,
    ext=None,
    env=None,
    funcs=None,
    pillar=None,
    pillarenv=None,
):
    """
    Return the correct pillar driver based on the file_client option
    """
    if env is not None:
        salt.utils.warn_until(
            "Boron",
            "Passing a salt environment should be done using 'saltenv' "
            "not 'env'. This functionality will be removed in Salt Boron.",
        )
        # Backwards compatibility
        saltenv = env
    ptype = {
        "remote": AsyncRemotePillar,
        #'local': AsyncPillar  # TODO: implement
    }.get(opts["file_client"], Pillar)
    return ptype(
        opts,
        grains,
        id_,
        saltenv,
        ext,
        functions=funcs,
        pillar=pillar,
        pillarenv=pillarenv,
    )


# Traceback (AssertionError)
2015-06-05 11:15:14,072 [salt.scripts                             ][ERROR   ][25853] Minion failed to start:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 81, in minion_process
minion.start()
File "/usr/lib/python2.7/dist-packages/salt/cli/daemons.py", line 269, in start
self.minion.tune_in()
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1593, in tune_in
self.sync_connect_master()
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 589, in sync_connect_master
raise six.reraise(*future_exception)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 879, in run
yielded = self.gen.send(value)
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 597, in connect_master
yield self._post_master_init(master)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 242, in wrapper
Runner(result, future, yielded)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 817, in __init__
if self.handle_yield(first_yielded):
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 956, in handle_yield
self.future = convert_yielded(yielded)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1022, in convert_yielded
return multi_future(yielded)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 643, in multi_future
assert all(is_future(i) for i in children)
AssertionError
2015-06-05 11:15:14,073 [salt.scripts                             ][WARNING ][25853] ** Restarting minion **

# Fixed code
def get_async_pillar(
    opts,
    grains,
    id_,
    saltenv=None,
    ext=None,
    env=None,
    funcs=None,
    pillar=None,
    pillarenv=None,
):
    """
    Return the correct pillar driver based on the file_client option
    """
    if env is not None:
        salt.utils.warn_until(
            "Boron",
            "Passing a salt environment should be done using 'saltenv' "
            "not 'env'. This functionality will be removed in Salt Boron.",
        )
        # Backwards compatibility
        saltenv = env
    ptype = {
        "remote": AsyncRemotePillar,
        "local": AsyncPillar,
    }.get(opts["file_client"], AsyncPillar)
    return ptype(
        opts,
        grains,
        id_,
        saltenv,
        ext,
        functions=funcs,
        pillar=pillar,
        pillarenv=pillarenv,
    )