Keep in mind that this currently lives in a private module inside pyrepl (which is itself private) so the implementation is subject to breaking changes without notice.
However, if you really want to use it, this should do what you want:
>>> from _pyrepl._module_completer import ModuleCompleter
>>> c = ModuleCompleter()
>>> c.get_completions('import pa')
['pathlib']