def set_attributes(instance, **kwargs):
    """
    sets the provided keyword arguments as attributes in given object instance.

    :param CoreObject instance: instance to set attributes for.

    :returns: instance with updated attributes.
    :rtype: CoreObject
    """
    if instance is None:
        return instance
    for name, value in kwargs.items():
        setattr(instance, name, value)
    return instance
