nodes: 0, module; 1, function_definition; 2, function_name:run_sorter; 3, parameters; 4, block; 5, identifier:sorter_name_or_class; 6, identifier:recording; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, dictionary_splat_pattern; 13, expression_statement; 14, if_statement; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, return_statement; 20, identifier:output_folder; 21, None; 22, identifier:delete_output_folder; 23, False; 24, identifier:grouping_property; 25, None; 26, identifier:parallel; 27, False; 28, identifier:debug; 29, False; 30, identifier:params; 31, comment:"""
      Generic function to run a sorter via function approach.
  
      2 Usage with name or class:
  
      by name:
         >>> sorting = run_sorter('tridesclous', recording)
  
      by class:
         >>> sorting = run_sorter(TridesclousSorter, recording)
  
      """; 32, call; 33, block; 34, elif_clause; 35, else_clause; 36, assignment; 37, call; 38, call; 39, assignment; 40, identifier:sortingextractor; 41, identifier:isinstance; 42, argument_list; 43, expression_statement; 44, comparison_operator:sorter_name_or_class in sorter_full_list; 45, block; 46, block; 47, identifier:sorter; 48, call; 49, attribute; 50, argument_list; 51, attribute; 52, argument_list; 53, identifier:sortingextractor; 54, call; 55, identifier:sorter_name_or_class; 56, identifier:str; 57, assignment; 58, identifier:sorter_name_or_class; 59, identifier:sorter_full_list; 60, expression_statement; 61, raise_statement; 62, identifier:SorterClass; 63, argument_list; 64, identifier:sorter; 65, identifier:set_params; 66, dictionary_splat; 67, identifier:sorter; 68, identifier:run; 69, attribute; 70, argument_list; 71, identifier:SorterClass; 72, subscript; 73, assignment; 74, parenthesized_expression; 75, keyword_argument; 76, keyword_argument; 77, keyword_argument; 78, keyword_argument; 79, keyword_argument; 80, keyword_argument; 81, identifier:params; 82, identifier:sorter; 83, identifier:get_result; 84, identifier:sorter_dict; 85, identifier:sorter_name_or_class; 86, identifier:SorterClass; 87, identifier:sorter_name_or_class; 88, call; 89, identifier:recording; 90, identifier:recording; 91, identifier:output_folder; 92, identifier:output_folder; 93, identifier:grouping_property; 94, identifier:grouping_property; 95, identifier:parallel; 96, identifier:parallel; 97, identifier:debug; 98, identifier:debug; 99, identifier:delete_output_folder; 100, identifier:delete_output_folder; 101, identifier:ValueError; 102, argument_list; 103, string; 104, string_content:Unknown sorter
code: def run_sorter(sorter_name_or_class, recording, output_folder=None, delete_output_folder=False,
                 grouping_property=None, parallel=False, debug=False, **params):
      """
      Generic function to run a sorter via function approach.
  
      2 Usage with name or class:
  
      by name:
         >>> sorting = run_sorter('tridesclous', recording)
  
      by class:
         >>> sorting = run_sorter(TridesclousSorter, recording)
  
      """
  
      if isinstance(sorter_name_or_class, str):
          SorterClass = sorter_dict[sorter_name_or_class]
      elif sorter_name_or_class in sorter_full_list:
          SorterClass = sorter_name_or_class
      else:
          raise(ValueError('Unknown sorter'))
  
      sorter = SorterClass(recording=recording, output_folder=output_folder, grouping_property=grouping_property,
                           parallel=parallel, debug=debug, delete_output_folder=delete_output_folder)
      sorter.set_params(**params)
      sorter.run()
      sortingextractor = sorter.get_result()
  
      return sortingextractor