def get_xattrs(self, path, xattr_name=None, encoding='text', **kwargs):
        """Get one or more xattr values for a file or directory.

        :param xattr_name: ``str`` to get one attribute, ``list`` to get multiple attributes,
            ``None`` to get all attributes.
        :param encoding: ``text`` | ``hex`` | ``base64``, defaults to ``text``

        :returns: Dictionary mapping xattr name to value. With text encoding, the value will be a
            unicode string. With hex or base64 encoding, the value will be a byte array.
        :rtype: dict
        """
        kwargs['xattr.name'] = xattr_name
        json = _json(self._get(path, 'GETXATTRS', encoding=encoding, **kwargs))['XAttrs']
        # Decode the result
        result = {}
        for attr in json:
            k = attr['name']
            v = attr['value']
            if v is None:
                result[k] = None
            elif encoding == 'text':
                assert attr['value'].startswith('"') and attr['value'].endswith('"')
                result[k] = v[1:-1]
            elif encoding == 'hex':
                assert attr['value'].startswith('0x')
                # older python demands bytes, so we have to ascii encode
                result[k] = binascii.unhexlify(v[2:].encode('ascii'))
            elif encoding == 'base64':
                assert attr['value'].startswith('0s')
                # older python demands bytes, so we have to ascii encode
                result[k] = base64.b64decode(v[2:].encode('ascii'))
            else:
                warnings.warn("Unexpected encoding {}".format(encoding))
                result[k] = v
        return result
Get one or more xattr values for a file or directory.

        :param xattr_name: ``str`` to get one attribute, ``list`` to get multiple attributes,
            ``None`` to get all attributes.
        :param encoding: ``text`` | ``hex`` | ``base64``, defaults to ``text``

        :returns: Dictionary mapping xattr name to value. With text encoding, the value will be a
            unicode string. With hex or base64 encoding, the value will be a byte array.
        :rtype: dict