nodes: 0, module; 1, function_definition; 2, function_name:_sorter; 3, parameters; 4, block; 5, identifier:generated; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Return a list of paths sorted by dirname & basename."""; 11, assignment; 12, call; 13, list_comprehension; 14, identifier:pairs; 15, list_comprehension; 16, attribute; 17, argument_list; 18, call; 19, for_in_clause; 20, tuple; 21, for_in_clause; 22, identifier:pairs; 23, identifier:sort; 24, attribute; 25, argument_list; 26, identifier:pair; 27, identifier:pairs; 28, call; 29, call; 30, identifier:f; 31, call; 32, attribute; 33, identifier:join; 34, subscript; 35, subscript; 36, attribute; 37, argument_list; 38, attribute; 39, argument_list; 40, identifier:set; 41, argument_list; 42, identifier:os; 43, identifier:path; 44, identifier:pair; 45, integer:0; 46, identifier:pair; 47, integer:1; 48, attribute; 49, identifier:dirname; 50, identifier:f; 51, attribute; 52, identifier:basename; 53, identifier:f; 54, call; 55, identifier:os; 56, identifier:path; 57, identifier:os; 58, identifier:path; 59, identifier:list; 60, argument_list; 61, identifier:generated
code: def _sorter(generated):
      """Return a list of paths sorted by dirname & basename."""
      pairs = [(os.path.dirname(f), os.path.basename(f))
               for f in set(list(generated))]
  
      pairs.sort()
  
      return [os.path.join(pair[0], pair[1]) for pair in pairs]