code: def replace_source(g, source, dest, new_source):
      if isinstance(source, six.string_types):
          source = g[source]
      if isinstance(dest, six.string_types):
          dest = g[dest]
      if isinstance(new_source, six.string_types):
          new_source = g[new_source]
      dest_inputs = []
      for inp in dest.inputs:
          if inp == source.name:
              dest_inputs.append(new_source.name)
              g[new_source.name].outputs.append(dest.name)
          else:
              dest_inputs.append(inp)
      dest.inputs = dest_inputs
      source.outputs = [
          i for i in g[source.name].outputs if i != dest.name
      ]
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import six
label_desc: Use image node_id 3 for calling a global function with example usage: replace_source(g, source, dest, new_source) without return types