code: def create_cell_op_candidates(
      op_candidates, node_index, op_index, chosen
  ) -> Tuple[Dict[str, nn.Module], bool]:
      has_factory = False
  
      # convert the complex type into the type that is acceptable to LayerChoice
      def convert_single_op(op):
          nonlocal has_factory
  
          if isinstance(op, nn.Module):
              return copy.deepcopy(op)
          elif callable(op):
              # Yes! It's using factory to create operations now.
              has_factory = True
              # FIXME: I don't know how to check whether we are in graph engine.
              return op(node_index, op_index, chosen)
          else:
              raise TypeError(
                  f"Unrecognized type {type(op)} for op {op}"
              )
  
      if isinstance(op_candidates, list):
          res = {
              str(i): convert_single_op(op)
              for i, op in enumerate(op_candidates)
          }
      elif isinstance(op_candidates, dict):
          res = {
              key: convert_single_op(op)
              for key, op in op_candidates.items()
          }
      elif callable(op_candidates):
          warnings.warn(
              f"Directly passing a callable into Cell is deprecated. Please consider migrating to list or dict.",
              DeprecationWarning,
          )
          res = op_candidates()
          has_factory = True
      else:
          raise TypeError(
              f"Unrecognized type {type(op_candidates)} for {op_candidates}"
          )
  
      return res, has_factory
  
imports: import copy
  import logging
  import warnings
  from typing import Callable, Dict, List, Union, Optional, Tuple, Sequence, Union, cast
  import torch
  import torch.nn
  from nni.mutable import Sample, label_scope
  from nni.nas.space import model_context
  from .choice import ChosenInputs, LayerChoice, InputChoice
  from .base import MutableModule
label_desc: Use image node_id 1 for calling a global function with example usage: create_cell_op_candidates(op_candidates, node_index, op_index, chosen) and returns: res,  has_factory, copy, op