def deepSetAttr(obj, path, val):
    """
    Sets a deep attribute on an object by resolving a dot-delimited
    path. If path does not exist an `AttributeError` will be raised`.
    """
    first, _, rest = path.rpartition('.')
    return setattr(deepGetAttr(obj, first) if first else obj, rest, val)