def getattr_dunder(obj, attr):
    """Gets attribute of object. Works recursively
    if attr contains double underscores."""

    first, dunder, rest = attr.partition('__')
    value = getattr(obj, first)
    if rest:
        return getattr_dunder(value, rest)
    return value