code: def model_to_pytorch_script(model: GraphModelSpace) -> str:
      graphs = []
      total_pkgs = set()
      for name, cell in model.graphs.items():
          import_pkgs, graph_code = graph_to_pytorch_model(
              name, cell, placement=model.placement
          )
          graphs.append(graph_code)
          total_pkgs.update(import_pkgs)
      pkgs_code = "\n".join(
          ["import {}".format(pkg) for pkg in total_pkgs]
      )
      return _PyTorchScriptTemplate.format(
          pkgs_code, "\n\n".join(graphs)
      ).strip()
  
file_path: nni/nni/nas/space/pytorch/codegen.py
imports: import logging
  import re
  from typing import Dict, List, Tuple, Any, cast
  from nni.common.device import Device, GPUDevice
  from nni.nas.space.graph import IllegalGraphError, Edge, Graph, Node, GraphModelSpace
  from nni.nas.space.graph_op import PyTorchOperation
  from nni.nas.utils import STATE_DICT_PY_MAPPING
  from .op_def import ToDevice
label_desc: Use image node_id 1 for calling a global function with example usage: model_to_pytorch_script(model) and returns: _PyTorchScriptTemplate