def _attrgetter(attr):
    """
    Return a callable object that fetches attr from its operand.

    Unlike operator.attrgetter, the returned callable supports an extra two
    arg form for a default.
    """
    def fn(obj, *args):
        return getattr(obj, attr, *args)

    return fn