code: def _sorter(generated):
      
      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]
docs: Return a list of paths sorted by dirname & basename.