def pick(attr):
    """Return a function that picks 'attr' from the 3rd param to that fn.

    If attr doesn't exist on the object, then just return the object.

    :param attr: the attribute to get from the 3rd param of the function that
    will be returned.
    :type attr: str
    :returns: A function that takes 3 params and returns the 3rd with a picked
        attribute
    :rtype: Callable[[Any, Any, object], Any]
    """
    return lambda _, __, x: getattr(x, attr, x)