code: def as_objective(obj):
      """Convert obj into Objective class.
  
      Strings of the form "layer:n" become the Objective channel(layer, n).
      Objectives are returned unchanged.
  
      Args:
        obj: string or Objective.
  
      Returns:
        Objective
      """
      if isinstance(obj, Objective):
          return obj
      elif callable(obj):
          return obj
      elif isinstance(obj, str):
          layer, n = obj.split(":")
          layer, n = layer.strip(), int(n)
          return channel(layer, n)
  
imports: from __future__ import absolute_import, division, print_function
  from decorator import decorator
  import numpy
  import tensorflow
  from lucid.optvis.objectives_util import _dot, _dot_cossim, _extract_act_pos, _make_arg_str, _T_force_NHWC, _T_handle_batch
label_desc: Use image node_id 21 for calling a global function with example usage: as_objective(obj) and returns: obj, obj, channel