def METHOD_NAME(cls, regions, filename, classobj, format=None, **kwargs):
    """
    Write to a regions file.
    """
    if format is None:
        format = cls.identify_format(filename, classobj, 'write')
    key = (classobj, 'write', format)
    try:
        writer = cls.registry[key]
    except KeyError:
        msg = (f'No writer defined for format "{format}" and class '
               f'"{classobj.__name__}".\n'
               f'{cls._get_format_table_str(classobj)}')
        raise IORegistryError(msg) from None
    return writer(regions, filename, **kwargs)