          for i in tqdm(range(0, img_list_len - 1), desc="Comparing", file=sys.stdout):
              min_score = float("inf")
              j_min_score = i + 1
              for j in range(i + 1, img_list_len):
                  score = cv2.compareHist(img_list[i][1], img_list[j][1], distance)
                  if score < min_score:
                      min_score = score
                      j_min_score = j
              (img_list[i + 1], img_list[j_min_score]) = (img_list[j_min_score], img_list[i + 1])
          return img_list
 
</s> remove         for i in tqdm(range(0, img_list_len - 1), desc="Comparing", file=sys.stdout):
 </s> add         for i in tqdm(range(0, img_list_len - 1), desc="Comparing histograms", file=sys.stdout): </s> remove         for i in tqdm(range(0, img_list_len - 1), desc="Comparing...", file=sys.stdout):
 </s> add         for i in tqdm(range(0, img_list_len - 1), desc="Comparing", file=sys.stdout): </s> remove         for i in tqdm(range(0, img_list_len - 1), desc="Comparing...", file=sys.stdout):
 </s> add         for i in tqdm(range(0, img_list_len - 1), desc="Comparing", file=sys.stdout): </s> remove         for i in tqdm(range(0, img_list_len), desc="Comparing", file=sys.stdout):
 </s> add         for i in tqdm(range(0, img_list_len), desc="Comparing histograms", file=sys.stdout): </s> remove                 score_total += cv2.compareHist(img_list[i][1], img_list[j][1], distance)
 </s> add                 score_total += cv2.compareHist(img_list[i][1],
                                               img_list[j][1],
                                               cv2.HISTCMP_BHATTACHARYYA)
                score = cv2.compareHist(img_list[i][1], img_list[j][1], cv2.HISTCMP_BHATTACHARYYA)
          for i in tqdm(range(0, img_list_len - 1), desc="Comparing", file=sys.stdout):
              min_score = float("inf")
              j_min_score = i + 1
              for j in range(i + 1, img_list_len):
                score = cv2.compareHist(img_list[i][1], img_list[j][1], cv2.HISTCMP_BHATTACHARYYA)
                  if score < min_score:
                      min_score = score
                      j_min_score = j
              (img_list[i + 1], img_list[j_min_score]) = (img_list[j_min_score], img_list[i + 1])
          return img_list
keep keep keep keep replace keep keep keep keep keep
 tools.sort
  - Add sort by size
  - Centralize some of the image loading routines 
tools/sort/sort.py