from functools import reduce


def dotted_getattr(obj, name):
    """
    `getattr` like function accepting a dotted name for attribute lookup.
    """
    return reduce(getattr, name.split("."), obj)