code: def get_cfg_func(self):
      def config(
          data: DataFactory.filter(
              "linkpred"
          ).get_dataset_enum() = typer.Option(
              ..., help="input data name"
          ),
          cfg: str = typer.Option(
              "cfg.yaml", help="output configuration path"
          ),
          node_model: NodeModelFactory.get_model_enum() = typer.Option(
              ..., help="Model name"
          ),
          edge_model: EdgeModelFactory.get_model_enum() = typer.Option(
              ..., help="Model name"
          ),
          neg_sampler: NegativeSamplerFactory.get_model_enum() = typer.Option(
              "persource", help="Negative sampler name"
          ),
      ):
          self.__class__.setup_user_cfg_cls()
          generated_cfg = {
              "pipeline_name": self.pipeline["name"],
              "pipeline_mode": self.pipeline["mode"],
              "device": "cpu",
              "data": {"name": data.name},
              "neg_sampler": {"name": neg_sampler.value},
              "node_model": {"name": node_model.value},
              "edge_model": {"name": edge_model.value},
          }
          output_cfg = self.user_cfg_cls(**generated_cfg).dict()
          output_cfg = deep_convert_dict(output_cfg)
          comment_dict = {
              "device": "Torch device name, e.g., cpu or cuda or cuda:0",
              "general_pipeline": pipeline_comments,
              "node_model": NodeModelFactory.get_constructor_doc_dict(
                  node_model.value
              ),
              "edge_model": EdgeModelFactory.get_constructor_doc_dict(
                  edge_model.value
              ),
              "neg_sampler": NegativeSamplerFactory.get_constructor_doc_dict(
                  neg_sampler.value
              ),
              "data": {
                  "split_ratio": "List of float, e.q. [0.8, 0.1, 0.1]. Split ratios for training, validation and test sets. Must sum to one. Leave blank to use builtin split in original dataset",
                  "neg_ratio": "Int, e.q. 2. Indicate how much negative samples to be sampled per positive samples. Leave blank to use builtin split in original dataset",
              },
          }
          comment_dict = merge_comment(output_cfg, comment_dict)
  
          if cfg is None:
              cfg = (
                  "_".join(
                      [
                          "linkpred",
                          data.value,
                          node_model.value,
                          edge_model.value,
                      ]
                  )
                  + ".yaml"
              )
          yaml = ruamel.yaml.YAML()
          yaml.dump(comment_dict, Path(cfg).open("w"))
          print(
              "Configuration file is generated at {}".format(
                  Path(cfg).absolute()
              )
          )
  
      return config
  
imports: import copy
  from pathlib import Path
  from typing import Optional
  import ruamel.yaml
  import typer
  import yaml
  from jinja2 import Template
  from pydantic import BaseModel, Field
  from ruamel.yaml.comments import CommentedMap
  from ...utils.base_model import DeviceEnum, EarlyStopConfig
  from ...utils.factory import DataFactory, EdgeModelFactory, NegativeSamplerFactory, NodeModelFactory, PipelineBase, PipelineFactory
  from ...utils.yaml_dump import deep_convert_dict, merge_comment
label_desc: Use image node_id 4 for calling the LinkpredPipeline obj's underlying member method code with example usage: obj.get_cfg_func() and returns: config