def _prompt_wrapper(message, default=None, validator=None):
    """ Handle references piped from file
    """

    class MockDocument:

        def __init__(self, text):
            self.text = text

    if HAS_INPUT:
        ret = prompt(message, default=default, validator=validator)
    else:
        ret = sys.stdin.readline().strip()
        print(message, ret)
        if validator:
            validator.validate(MockDocument(ret))
    if "q" in ret:
        if not HAS_OUTPUT:
            print("User exit")
        sys.exit("User exit")
    return ret
Handle references piped from file