code: def list_insert(lst, new_elements, index_or_name=None, after=True):
      
      if index_or_name is None:
          index = None
      else:
          try:
              index = get_list_index(lst, index_or_name)
          except ValueError:
              index = None
  
      to_return = lst[:]
      if index is None:  # Append.
          to_return += new_elements
      elif index == 0:  # Prepend.
          to_return = new_elements + to_return
      else:
          if after:
              index += 1
          to_return = to_return[:index] + new_elements + to_return[index:]
      return to_return
docs: Return a copy of the list with the new element(s) inserted.
  
      Args:
          lst (list): The original list.
          new_elements ("any" or list of "any"): The element(s) to insert in the list.
          index_or_name (int or str): The value of the reference element, or directly its numeric index.
                                      Default: None (=append).
          after (bool): Whether to insert the new elements before or after the reference element. Default: True.
  
      Returns:
          (list) A copy of the original list containing the new element(s).