def plt_range(*args, **kwargs):
wait = kwargs.pop('<STR_LIT>', True)<EOL>if not wait:<EOL><INDENT>for i in progress(range(*args)):<EOL><INDENT>yield i<EOL><DEDENT>return<EOL><DEDENT>class _holder(object):<EOL><INDENT>pass<EOL><DEDENT>hold = _holder()<EOL>hold.i = <NUM_LIT:0><EOL>hold.done = False<EOL>def press(event):<EOL><INDENT>hold.i += -<NUM_LIT:1> if event.key == '<STR_LIT:left>' else <NUM_LIT:1><EOL>hold.i = <NUM_LIT:0> if hold.i < <NUM_LIT:0> else hold.i<EOL><DEDENT>def onclose(event):<EOL><INDENT>hold.done = True<EOL><DEDENT>fig = kwargs.pop('<STR_LIT>', None)<EOL>figsize = kwargs.pop('<STR_LIT>', None)<EOL>if fig is None:<EOL><INDENT>fig = plt.gcf()<EOL>if figsize:<EOL><INDENT>fig.set_size_inches(figsize)<EOL><DEDENT><DEDENT>elif isinstance(fig, (int, str)):<EOL><INDENT>if figsize:<EOL><INDENT>fig = plt.figure(fig, figsize=figsize)<EOL><DEDENT>else:<EOL><INDENT>fig = plt.figure(fig)<EOL><DEDENT><DEDENT>elif isinstance(fig, plt.Figure):<EOL><INDENT>if figsize:<EOL><INDENT>fig.set_size_inches(figsize)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError<EOL><DEDENT>onkey_fig(press, fig)<EOL>onclose_fig(onclose, fig)<EOL>ranges = range(*args)<EOL>l = len(ranges)<EOL>while hold.i < l:<EOL><INDENT>print('<STR_LIT>', ranges[hold.i])<EOL>yield ranges[hold.i]  <EOL>before = hold.i<EOL>while before == hold.i:<EOL><INDENT>while not fig.waitforbuttonpress(<NUM_LIT>):<EOL><INDENT>if hold.done:<EOL><INDENT>return<EOL><DEDENT><DEDENT>while fig.waitforbuttonpress(<NUM_LIT:0.1>):<EOL><INDENT>if hold.done:<EOL><INDENT>return<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
for i in plot_range(n):
    plt.imshow(imgs[i])

left arrow yield prev value
other key yield next value
:param args:
:return: