code: def sort_filenames(filenames):
      basenames = [os.path.basename(x) for x in filenames]
      indexes = [i[0] for i in sorted(enumerate(basenames), key=lambda x:x[1])]
      return [filenames[x] for x in indexes]