def set_obj_value(data_obj, attr, value):
    """Set dict's key or object's attribute with given attr and value"""
    if isinstance(data_obj, dict):
        return data_obj.update({attr: value})
    return setattr(data_obj, attr, value)