nodes: 0, module; 1, function_definition; 2, function_name:sfiles_to_event; 3, parameters; 4, block; 5, identifier:sfile_list; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, comment:# Hand off to sister function; 14, expression_statement; 15, return_statement; 16, comment:"""
      Write an event.dat file from a list of Seisan events
  
      :type sfile_list: list
      :param sfile_list: List of s-files to sort and put into the database
  
      :returns: List of tuples of event ID (int) and Sfile name
      """; 17, assignment; 18, assignment; 19, call; 20, assignment; 21, assignment; 22, pattern_list; 23, call; 24, block; 25, call; 26, identifier:event_list; 27, identifier:event_list; 28, list; 29, identifier:sort_list; 30, list_comprehension; 31, attribute; 32, argument_list; 33, identifier:sfile_list; 34, list_comprehension; 35, identifier:catalog; 36, call; 37, identifier:i; 38, identifier:sfile; 39, identifier:enumerate; 40, argument_list; 41, expression_statement; 42, expression_statement; 43, identifier:write_event; 44, argument_list; 45, tuple; 46, for_in_clause; 47, identifier:sort_list; 48, identifier:sort; 49, keyword_argument; 50, subscript; 51, for_in_clause; 52, identifier:Catalog; 53, argument_list; 54, identifier:sfile_list; 55, call; 56, call; 57, identifier:catalog; 58, attribute; 59, identifier:sfile; 60, identifier:sfile; 61, identifier:sfile_list; 62, identifier:key; 63, lambda; 64, identifier:sfile; 65, integer:1; 66, identifier:sfile; 67, identifier:sort_list; 68, attribute; 69, argument_list; 70, attribute; 71, argument_list; 72, subscript; 73, identifier:time; 74, lambda_parameters; 75, subscript; 76, identifier:event_list; 77, identifier:append; 78, tuple; 79, identifier:catalog; 80, identifier:append; 81, call; 82, attribute; 83, integer:0; 84, identifier:tup; 85, identifier:tup; 86, integer:0; 87, identifier:i; 88, identifier:sfile; 89, identifier:readheader; 90, argument_list; 91, call; 92, identifier:origins; 93, identifier:sfile; 94, identifier:readheader; 95, argument_list; 96, identifier:sfile
code: def sfiles_to_event(sfile_list):
      """
      Write an event.dat file from a list of Seisan events
  
      :type sfile_list: list
      :param sfile_list: List of s-files to sort and put into the database
  
      :returns: List of tuples of event ID (int) and Sfile name
      """
      event_list = []
      sort_list = [(readheader(sfile).origins[0].time, sfile)
                   for sfile in sfile_list]
      sort_list.sort(key=lambda tup: tup[0])
      sfile_list = [sfile[1] for sfile in sort_list]
      catalog = Catalog()
      for i, sfile in enumerate(sfile_list):
          event_list.append((i, sfile))
          catalog.append(readheader(sfile))
      # Hand off to sister function
      write_event(catalog)
      return event_list