Start up a prompt that with particular delims and completer

def custom_prompt(msg, delims="", completer=lambda: None):
    """Start up a prompt that with particular delims and completer"""
    try:
        orig_delims = readline.get_completer_delims()
        orig_completer = readline.get_completer()

        readline.set_completer_delims(delims)
        readline.set_completer(completer)

        try:
            ret = input(msg)
        finally:
            readline.set_completer_delims(orig_delims)
            readline.set_completer(orig_completer)

        return ret
    except EOFError:
        raise UserQuit()