nodes: 0, module; 1, function_definition; 2, function_name:make_stmt_from_sort_key; 3, parameters; 4, block; 5, identifier:key; 6, identifier:verb; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""Make a Statement from the sort key.
  
      Specifically, the sort key used by `group_and_sort_statements`.
      """; 14, function_name:make_agent; 15, parameters; 16, block; 17, assignment; 18, assignment; 19, comparison_operator:verb == 'Complex'; 20, block; 21, elif_clause; 22, elif_clause; 23, else_clause; 24, identifier:stmt; 25, identifier:name; 26, if_statement; 27, return_statement; 28, identifier:StmtClass; 29, call; 30, identifier:inps; 31, call; 32, identifier:verb; 33, string; 34, expression_statement; 35, comparison_operator:verb == 'Conversion'; 36, block; 37, boolean_operator; 38, block; 39, block; 40, boolean_operator; 41, block; 42, call; 43, identifier:get_statement_by_name; 44, argument_list; 45, identifier:list; 46, argument_list; 47, string_content:Complex; 48, assignment; 49, identifier:verb; 50, string; 51, expression_statement; 52, comparison_operator:verb == 'ActiveForm'; 53, comparison_operator:verb == 'HasActivity'; 54, expression_statement; 55, expression_statement; 56, comparison_operator:name == 'None'; 57, comparison_operator:name is None; 58, return_statement; 59, identifier:Agent; 60, argument_list; 61, identifier:verb; 62, subscript; 63, identifier:stmt; 64, call; 65, string_content:Conversion; 66, assignment; 67, identifier:verb; 68, string; 69, identifier:verb; 70, string; 71, assignment; 72, assignment; 73, identifier:name; 74, string; 75, identifier:name; 76, None; 77, None; 78, identifier:name; 79, identifier:key; 80, integer:1; 81, identifier:StmtClass; 82, argument_list; 83, identifier:stmt; 84, call; 85, string_content:ActiveForm; 86, string_content:HasActivity; 87, identifier:stmt; 88, call; 89, identifier:stmt; 90, call; 91, string_content:None; 92, list_comprehension; 93, identifier:StmtClass; 94, argument_list; 95, identifier:StmtClass; 96, argument_list; 97, identifier:StmtClass; 98, argument_list; 99, call; 100, for_in_clause; 101, call; 102, list_comprehension; 103, list_comprehension; 104, call; 105, subscript; 106, subscript; 107, list_splat; 108, identifier:make_agent; 109, argument_list; 110, identifier:name; 111, identifier:inps; 112, identifier:make_agent; 113, argument_list; 114, call; 115, for_in_clause; 116, call; 117, for_in_clause; 118, identifier:make_agent; 119, argument_list; 120, identifier:inps; 121, integer:1; 122, identifier:inps; 123, integer:2; 124, list_comprehension; 125, identifier:name; 126, subscript; 127, identifier:make_agent; 128, argument_list; 129, identifier:name; 130, subscript; 131, identifier:make_agent; 132, argument_list; 133, identifier:name; 134, subscript; 135, subscript; 136, call; 137, for_in_clause; 138, identifier:inps; 139, integer:0; 140, identifier:name; 141, identifier:inps; 142, integer:1; 143, identifier:name; 144, identifier:inps; 145, integer:2; 146, identifier:inps; 147, integer:0; 148, identifier:make_agent; 149, argument_list; 150, identifier:name; 151, identifier:inps; 152, identifier:name
code: def make_stmt_from_sort_key(key, verb):
      """Make a Statement from the sort key.
  
      Specifically, the sort key used by `group_and_sort_statements`.
      """
      def make_agent(name):
          if name == 'None' or name is None:
              return None
          return Agent(name)
  
      StmtClass = get_statement_by_name(verb)
      inps = list(key[1])
      if verb == 'Complex':
          stmt = StmtClass([make_agent(name) for name in inps])
      elif verb == 'Conversion':
          stmt = StmtClass(make_agent(inps[0]),
                           [make_agent(name) for name in inps[1]],
                           [make_agent(name) for name in inps[2]])
      elif verb == 'ActiveForm' or verb == 'HasActivity':
          stmt = StmtClass(make_agent(inps[0]), inps[1], inps[2])
      else:
          stmt = StmtClass(*[make_agent(name) for name in inps])
      return stmt