'Sets attribute ``name`` of the specified element to ``value``.
The element whose attribute to set is specified using ``source`` and
``xpath``. They have exactly the same semantics as with `Get Element`
keyword. The resulting XML structure is returned, and if the ``source``
is an already parsed XML structure, it is also modified in place.
It is possible to both set new attributes and to overwrite existing.
Use `Remove Element Attribute` or `Remove Element Attributes` for
removing them.
Examples using ``${XML}`` structure from `Example`:
| Set Element Attribute       | ${XML} | attr | value |
| Element Attribute Should Be | ${XML} | attr | value |
| Set Element Attribute       | ${XML} | id   | new   | xpath=first |
| Element Attribute Should Be | ${XML} | id   | new   | xpath=first |
Can only set an attribute of a single element. Use `Set Elements
Attribute` to set an attribute of multiple elements in one call.'

def set_element_attribute(self, source, name, value, xpath='.'):

    if (not name):
        raise RuntimeError('Attribute    name    can    not    be    empty.')
    source = self.get_element(source)
    self.get_element(source, xpath).attrib[name] = value
    return source
