In addition to itemgetter(), also support attrgetter(). For named tuples and other objects.
Minimum: user decides / instructs which mode to use.
Some kind of auto-selection is also possible (if mapping, use itemgetter, fallback to attrgetter).
https://docs.python.org/3.5/library/operator.html#operator.itemgetter
https://docs.python.org/3.5/library/operator.html#operator.attrgetter