def by_key(key):
    """
    Returns a function that gets an item by the specified key.

    Example:
    (
        Slinkie(items)
            .sort(by_key('date'))
    )
    """

    return lambda items: items[key]