code: def _replace_in_list(ls, old_val, new_val):
      """Helper function to replace a value in a list."""
      try:
          idx = ls.index(old_val)
      except ValueError:
          pass
      else:
          ls[idx] = new_val
  
imports: from collections import OrderedDict
  from itertools import islice
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: _replace_in_list(ls, old_val, new_val) without return types