def get_type(atype, prompt="", default=None, input=raw_input, error=default_error):
    """Get user input of a particular base type."""
    while 1:
        if default is not None:
            text = input("%s [%s]> " % (prompt, default))
            if not text:
                return default
        else:
            text = input("%s> " % (prompt, ))
        try:
            val = ast.literal_eval(text)
        except (SyntaxError, __HOLE__):
            error("Error in input. Please enter a {} value.".format(atype.__name__))
            continue
        if type(val) is atype:
            return val
        else:
            error("Please enter a {} value.".format(atype.__name__))
dataset/ETHPy150Open kdart/pycopia/core/pycopia/cliutils.py/get_type