py/repl: Refactor autocomplete to reduce nesting.
py/repl: Refactor autocomplete to reduce nesting.

Originally at adafruit#4548

Signed-off-by: Artyom Skrobov <tyomitch@gmail.com>

---

Updated for Pycopy.

Change-Id: Id4d1d7e3e80e65f72920a92b731aa846fc5bb44a
Signed-off-by: Paul Sokolovsky <9dc5061f178bb11813e14f1ed02ba27eaf21fa5d@users.sourceforge.net>

pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython