def set_(name, value, profile=None, **kwargs):
    '''
    Set a key in etcd

    name
        The etcd key name, for example: ``/foo/bar/baz``.
    value
        The value the key should contain.

    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001

    '''

    created = False

    rtn = {
        'name': name,
        'comment': 'Key contains correct value',
        'result': True,
        'changes': {}
    }

    current = __salt__['etcd.get'](name, profile=profile, **kwargs)
    if not current:
        created = True

    result = __salt__['etcd.set'](name, value, profile=profile, **kwargs)

    if result and result != current:
        if created:
            rtn['comment'] = 'New key created'
        else:
            rtn['comment'] = 'Key value updated'
        rtn['changes'] = {
            name: value
        }

    return rtn