readline.set_completer()

readline.set_completer([function]) → None

Set or remove the completer function. The function is called as function(text, state), for state in 0, 1, 2, ..., until it returns a non-string. It should return the next possible completion starting with ‘text’.