def _ask_property(self, prompt, mandatory=True, check_path_exists=False, check_pattern=None, default_value=None):
        while True:
            if default_value is not None:
                value = input("%s [default: '%s']: " % (prompt, default_value))
            else:
                value = input("%s: " % prompt)

            if not value or value.strip() == "":
                if mandatory and default_value is None:
                    print("  Value is required. Please retry.")
                    continue
                else:
                    print("  Using default value '%s'" % default_value)
                    # this way, we can still check the path...
                    value = default_value

            if check_path_exists and not os.path.exists(value):
                print("'%s' does not exist. Please check and retry." % value)
                continue
            if check_pattern is not None and not check_pattern.match(str(value)):
                print("Input does not match pattern [%s]. Please check and retry." % check_pattern.pattern)
                continue
            print("")
            # user entered a valid value
            return value

    # recursively find the most narrow scope for a key
dataset/ETHPy150Open elastic/rally/esrally/config.py/Config._ask_property/original