def get_input(io, prompt="", default=None):
    """Get user input with an optional default value."""
    if default:
        ri = io.raw_input("%s [%s]> " % (prompt, default))
        if not ri:
            return default
        else:
            return ri
    else:
        return io.raw_input("%s> " % (prompt, ))
dataset/ETHPy150Open kdart/pycopia/CLI/pycopia/cursesio.py/get_input/original