def _creation_options_for_cog(creation_options, source_profile, blocksize):
    """
    it uses the profile of the source raster, override anything using the creation_options
    and guarantees we will have tiled raster and blocksize
    """
    if not creation_options:
        creation_options = {}
    creation_options['blocksize'] = blocksize
    creation_options['tiled'] = True
    defaults = {'nodata': None, 'compress': 'lzw'}
    for key in ['nodata', 'compress']:
        if key not in creation_options:
            creation_options[key] = source_profile.get(key, defaults.get(key))
    return creation_options
