def get_userinterface(uiname="UserInterface",
                ioname="IO.ConsoleIO", themename=None):
    if type(ioname) is str:
        ioobj = _get_object(ioname)
    elif hasattr(ioname, "write"):
        ioobj = ioname
    else:
        raise ValueError("ioname not a valid type")
    if not hasattr(ioobj, "close"):
        raise UIFindError("not a valid IO object: %r" % (ioobj,))

    uiobj = _get_object(uiname)
    if not hasattr(uiobj, "Print"):
        raise UIFindError("not a valid UI object: %r" % (uiobj,))
    if themename is not None:
        themeobj = _get_object(themename)
        if not issubclass(themeobj, Theme):
            raise UIFindError("not a valid Theme object: %r." % (themeobj,))
        return uiobj(ioobj(), theme=themeobj())
    else:
        return uiobj(ioobj())
dataset/ETHPy150Open kdart/pycopia/CLI/pycopia/UI.py/get_userinterface/original