code: def get_next_image(img_dir):
      
      images, current_wall = get_image_dir(img_dir)
      images.sort(key=lambda img: [int(x) if x.isdigit() else x
                                   for x in re.split('([0-9]+)', img)])
  
      try:
          next_index = images.index(current_wall) + 1
  
      except ValueError:
          next_index = 0
  
      try:
          image = images[next_index]
  
      except IndexError:
          image = images[0]
  
      return os.path.join(img_dir, image)
docs: Get the next image in a dir.