code: def _to_train_op_spec(train_op):
      if isinstance(train_op, subnetwork_lib.TrainOpSpec):
          return train_op
      return subnetwork_lib.TrainOpSpec(train_op)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import contextlib
  import copy
  import functools
  import inspect
  import os
  from absl import logging
  from adanet import ensemble
  from adanet import subnetwork
  from adanet import tf_compat
  from adanet.core.architecture import _Architecture
  from adanet.core.eval_metrics import _EnsembleMetrics
  from adanet.core.eval_metrics import _SubnetworkMetrics
  from adanet.core.summary import monkey_patched_summaries
  import tensorflow.compat.v1
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling a global function with example usage: _to_train_op_spec(train_op) and returns: subnetwork_lib, train_op