from functools import reduce


def rgetattr(obj, attr):
    """A "recursive" version of getattr that can handle nested objects.
    Args:
        obj (object): Parent object
        attr (string): Address of desired attribute with '.' between child
            objects.
    Returns:
        The attribute of obj referred to."""

    return reduce(getattr, [obj] + attr.split('.'))