code: def sort_dict_of_paths(d):
      
      # Find the path that is the deepest, and count the number of parts
      max_rec = max(len(x) if x else 0 for x in d.values())
      # Pad other paths with empty parts to fill in, so that all paths will have the same number of parts (necessary to compare correctly, else deeper paths may get precedence over top ones, since the folder name will be compared to filenames!)
      for key in d.keys():
          if d[key]:
              d[key] = ['']*(max_rec-len(d[key])) + d[key]
      # Sort the dict relatively to the paths alphabetical order
      d_sort = sorted(d.items(), key=lambda x: x[1])
      return d_sort
docs: Sort a dict containing paths parts (ie, paths divided in parts and stored as a list). Top paths will be given precedence over deeper paths.