'Returns all attributes of the specified element.
The element whose attributes to return is specified using ``source`` and
``xpath``. They have exactly the same semantics as with `Get Element`
keyword.
Attributes are returned as a Python dictionary. It is a copy of the
original attributes so modifying it has no effect on the XML structure.
Examples using ``${XML}`` structure from `Example`:
| ${attributes} = | Get Element Attributes      | ${XML} | first |
| Dictionary Should Contain Key | ${attributes} | id     |       |
| ${attributes} = | Get Element Attributes      | ${XML} | third |
| Should Be Empty | ${attributes}               |        |       |
Use `Get Element Attribute` to get the value of a single attribute.'

def get_element_attributes(self, source, xpath='.'):

    return dict(self.get_element(source, xpath).attrib)
