def things_by(by_what, things):
    """Convert list of dictionaries to dictionary of dictionaries.

    Positional arguments:
    things -- a list of dictionaries
    by_what -- key that must exist in all dictionaries in things. The value of
    this key is used as the key in the returned dictionary and so should be
    unique.
    """
    things_by = {}
    for thing in things:
        things_by[thing[by_what]] = thing
    return things_by