'Return the metadata for this raster or band. The return value is a
nested dictionary, where the first-level key is the metadata domain and
the second-level is the metadata item names and values for that domain.'

@property
def metadata(self):

    if (not capi.get_ds_metadata_domain_list):
        raise ValueError('GDAL    \xe2\x89\xa5    1.11    is    required    for    using    the    metadata    property.')
    domain_list = ['DEFAULT']
    meta_list = capi.get_ds_metadata_domain_list(self._ptr)
    if meta_list:
        counter = 0
        domain = meta_list[counter]
        while domain:
            domain_list.append(domain.decode())
            counter += 1
            domain = meta_list[counter]
    capi.free_dsl(meta_list)
    result = {}
    for domain in domain_list:
        data = capi.get_ds_metadata(self._ptr, (None if (domain == 'DEFAULT') else domain.encode()))
        if (not data):
            continue
        domain_meta = {}
        counter = 0
        item = data[counter]
        while item:
            (key, val) = item.decode().split('=')
            domain_meta[key] = val
            counter += 1
            item = data[counter]
        result[(domain if domain else 'DEFAULT')] = domain_meta
    return result
