def update_attributes(obj, **kwargs):
    """Update object with provided properties."""
    for k, v in kwargs.items():
        k = k.split('.') if '.' in k else k.split('__')
        o = obj
        for name in k[:-1]:
            o = getattr(o, name)
        getattr(o, k[-1])
        setattr(o, k[-1], v)
