def pull_key(key_fun):
    """Return a new dict with members of objs as values and values generated by key_fun as keys.

    pull_key(key_fun)(objs)

    :: Hashable K => (X -> K) -> Seq[X] -> {K : X}

    Equivalent to the following in Python 3:
      {key_fun(v):v for v in objs}

    >>> from operator import itemgetter
    >>> objs = [{'id': 1, 'name': 'Fred'}, {'id': 3, 'name': 'Wilma'}]
    >>> result = pull_key(itemgetter('id'))(objs)
    >>> sorted(result.keys())
    [1, 3]
    >>> result[1]['id'], result[1]['name']
    (1, 'Fred')
    >>> result[3]['id'], result[3]['name']
    (3, 'Wilma')
    """
    def pull_key_fun(objs):
        return dict((key_fun(value), value) for value in objs)
    return pull_key_fun