code: def config_from_flags():
      """Parses flags and returns the appropriate ImprovRnnConfig.
  
      Returns:
        The appropriate ImprovRnnConfig based on the supplied flags.
  
      Raises:
         ImprovRnnConfigError: When an invalid config is supplied.
      """
      if FLAGS.config not in improv_rnn_model.default_configs:
          raise ImprovRnnConfigError(
              "`--config` must be one of %s. Got %s."
              % (improv_rnn_model.default_configs.keys(), FLAGS.config)
          )
      config = improv_rnn_model.default_configs[FLAGS.config]
      config.hparams.parse(FLAGS.hparams)
      if FLAGS.generator_id is not None:
          config.details.id = FLAGS.generator_id
      if FLAGS.generator_description is not None:
          config.details.description = FLAGS.generator_description
      return config
  
imports: from magenta.models.improv_rnn import improv_rnn_model
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: config_from_flags() and returns: config