def METHOD_NAME(self, text, state):
    """
    This complete stuff is pretty weird, a generator would make
    a lot more sense, but probably due to backwards compatibility
    this is still the way how it works.
    The only important part is stuff in the ``state == 0`` flow,
    everything else has been copied from the ``rlcompleter`` std.
    library module.
    """
    if state == 0:
        sys.path.insert(0, os.getcwd())
        # Calling python doesn't have a path, so add to sys.path.
        try:
            logging.debug("Start REPL completion: " + repr(text))
            interpreter = Interpreter(text, [namespace_module.__dict__])
            completions = interpreter.METHOD_NAME(fuzzy=fuzzy)
            logging.debug("REPL completions: %s", completions)
            self.matches = [
                text[:len(text) - c._like_name_length] + c.name_with_symbols
                for c in completions
            ]
        except:
            logging.error("REPL Completion error:\n" + traceback.format_exc())
            raise
        finally:
            sys.path.pop(0)
    try:
        return self.matches[state]
    except IndexError:
        return None