code: def compose_nncf_config(
      nncf_config: dict, enabled_options: list[str]
  ) -> dict:
      """Compose NNCf config by selected options.
  
      :param nncf_config:
      :param enabled_options:
      :return: config
      """
      optimisation_parts = nncf_config
      optimisation_parts_to_choose = []
      if "order_of_parts" in optimisation_parts:
          # The result of applying the changes from optimisation parts
          # may depend on the order of applying the changes
          # (e.g. if for nncf_quantization it is sufficient to have `total_epochs=2`,
          #  but for sparsity it is required `total_epochs=50`)
          # So, user can define `order_of_parts` in the optimisation_config
          # to specify the order of applying the parts.
          order_of_parts = optimisation_parts["order_of_parts"]
          assert isinstance(
              order_of_parts, list
          ), 'The field "order_of_parts" in optimisation config should be a list'
  
          for part in enabled_options:
              assert part in order_of_parts, (
                  f"The part {part} is selected, "
                  "but it is absent in order_of_parts={order_of_parts}"
              )
  
          optimisation_parts_to_choose = [
              part for part in order_of_parts if part in enabled_options
          ]
  
      assert (
          "base" in optimisation_parts
      ), 'Error: the optimisation config does not contain the "base" part'
      nncf_config_part = optimisation_parts["base"]
  
      for part in optimisation_parts_to_choose:
          assert (
              part in optimisation_parts
          ), f'Error: the optimisation config does not contain the part "{part}"'
          optimisation_part_dict = optimisation_parts[part]
          try:
              nncf_config_part = merge_dicts_and_lists_b_into_a(
                  nncf_config_part, optimisation_part_dict
              )
          except AssertionError as cur_error:
              err_descr = (
                  f"Error during merging the parts of nncf configs:\n"
                  f"the current part={part}, "
                  f"the order of merging parts into base is {optimisation_parts_to_choose}.\n"
                  f"The error is:\n{cur_error}"
              )
              raise RuntimeError(err_descr) from None
  
      return nncf_config_part
  
imports: from __future__ import annotations
  import logging
  from copy import copy
  from typing import Any, Iterator
  from nncf import NNCFConfig
  from nncf.api.compression import CompressionAlgorithmController
  from nncf.torch import create_compressed_model, load_state, register_default_init_args
  from nncf.torch.initialization import PTInitializingDataLoader
  from nncf.torch.nncf_network import NNCFNetwork
  from torch import nn
  from torch.utils.data.dataloader import DataLoader
label_desc: Use image node_id 3 for calling a global function with example usage: compose_nncf_config(nncf_config, enabled_options) and returns: nncf_config_part