code: def test_using_a_named_config(ex):
      @ex.config
      def cfg():
          a = 1
  
      @ex.named_config
      def ncfg_first():
          a = 10
  
      @ex.named_config
      def ncfg_second(a):
          a = a * 2
  
      @ex.main
      def run(a):
          return a
  
      assert ex.run().result == 1
      assert ex.run(named_configs=["ncfg_first"]).result == 10
      assert (
          ex.run(named_configs=["ncfg_first", "ncfg_second"]).result
          == 20
      )
      with pytest.raises(
          KeyError, match=r".*not in preset for ConfigScope"
      ):
          ex.run(named_configs=["ncfg_second", "ncfg_first"])
  
imports: from sacred import Ingredient
  from mock import patch
  import pytest
  import sys
  from sacred import cli_option
  from sacred import host_info_gatherer
  from sacred.experiment import Experiment
  from sacred.utils import apply_backspaces_and_linefeeds, ConfigAddedError, SacredError
label_desc: Use image node_id 10 for calling a global function with example usage: test_using_a_named_config(ex) and returns: a