code: def as_objective(obj):
    
    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)
docs: 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