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