def sldDump(sldObj):
    """
    Creates valid SldStyle string from an object.
    """
    sld_type = sldObj.get('type', None)
    extended = str(sldObj.get('extended', 'false')).lower()
    items = sldObj.get('items', None)
    sld_attr = {'color': None, 'label': None, 'quantity': None, 'opacity': None
        }
    if sld_type not in ['linear', 'ramp', 'gradient', 'intervals', 'values']:
        print(
            'Unable to create SldStyle. Type must be in "linear", "ramp", "gradient", "intervals", "values".'
            )
        return None
    if items:
        sld_str = (
            f'<RasterSymbolizer> <ColorMap type="{sld_type}" extended="{extended}"> '
            )
        for item in items:
            sld_str += f'<ColorMapEntry '
            for k in sld_attr.keys():
                if item.get(k, None):
                    sld_str += f'{k}="{item[k]}" '
            sld_str += '/> + '
    return sld_str + '</ColorMap> </RasterSymbolizer>'
