code: def task_event_list(task_id, limit, filter_errors, filter_non_errors):
      
      client = get_client()
  
      # cannot filter by both errors and non errors
      if filter_errors and filter_non_errors:
          raise click.UsageError("Cannot filter by both errors and non errors")
  
      elif filter_errors:
          filter_string = "is_error:1"
  
      elif filter_non_errors:
          filter_string = "is_error:0"
  
      else:
          filter_string = ""
  
      event_iterator = client.task_event_list(
          task_id, num_results=limit, filter=filter_string
      )
  
      def squashed_json_details(x):
          is_json = False
          try:
              loaded = json.loads(x["details"])
              is_json = True
          except ValueError:
              loaded = x["details"]
  
          if is_json:
              return json.dumps(loaded, separators=(",", ":"), sort_keys=True)
          else:
              return loaded.replace("\n", "\\n")
  
      formatted_print(
          event_iterator,
          fields=(
              ("Time", "time"),
              ("Code", "code"),
              ("Is Error", "is_error"),
              ("Details", squashed_json_details),
          ),
          json_converter=iterable_response_to_dict,
      )
docs: Executor for `globus task-event-list`