def METHOD_NAME(
    graph: NNCFGraph,
    ignored_scopes: Union[IgnoredScope, List[str]],
    target_scopes: Optional[List[str]] = None,
    validate_scopes: bool = True,
) -> None:
    """
    Raise RuntimeError in case if ignored/target scope names do not match model graph.
    :param graph: The model graph.
    :param ignored_scopes: The instance of IgnoredScope or a list of strings specifying a denylist
        for the serializable_id.
    :param target_scopes: A list of strings specifying an allowlist for the serializable_id.
    :param validate_scopes: If set to True, then a RuntimeError will be raised if the names of the
      ignored/target scopes do not match the names of the scopes in the model graph.
    """
    node_list = graph.get_all_nodes()
    not_matched_ignored_scopes = get_not_matched_scopes(ignored_scopes, node_list)
    not_matched_target_scopes = get_not_matched_scopes(target_scopes, node_list)
    if not_matched_ignored_scopes or not_matched_target_scopes:
        err_message = (
            "No match has been found among the model operations "
            "for the following ignored/target scope definitions:\n"
        )
        if not_matched_ignored_scopes:
            err_message += f" - ignored_scope: {not_matched_ignored_scopes}\n"
        if not_matched_target_scopes:
            err_message += f" - target_scope: {not_matched_target_scopes}\n"
        err_message += (
            "Refer to the original_graph.dot to discover the operations "
            "in the model currently visible to NNCF and specify the ignored/target "
            "scopes in terms of the names there."
        )
        if validate_scopes:
            raise RuntimeError(err_message)
        nncf_logger.info(err_message)