code: def process_keep(input_list, keep):
      if keep == "first":
          return input_list[1:]
      elif keep == "last":
          return input_list[:-1]
      return input_list
  
imports: import pandas
  import dtale.global_state
  from dtale.query import run_query
  from dtale.utils import dict_merge, grid_columns, grid_formatter, triple_quote
  from dtale.charts.utils import build_group_inputs_filter
label_desc: Use image node_id 1 for calling a global function with example usage: process_keep(input_list, keep) and returns: input_list, input_list, input_list