def _get_valid_int_ans(self, max_):
        selection = -1
        if max_ > 1:
            input_msg = ("Select the appropriate number "
                         "[1-{max_}] then [enter] (press 'c' to "
                         "cancel): ".format(max_=max_))
        else:
            input_msg = ("Press 1 [enter] to confirm the selection "
                         "(press 'c' to cancel): ")
        while selection < 1:
            ans = raw_input(input_msg)
            if ans.startswith("c") or ans.startswith("C"):
                return CANCEL, -1
            try:
                selection = int(ans)
                if selection < 1 or selection > max_:
                    selection = -1
                    raise ValueError

            except ValueError:
                self.outfile.write(
                    "{0}** Invalid input **{0}".format(os.linesep))

        return OK, selection
Adds a picklable Python object as a file to IPFS.
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/display/util.py/FileDisplay._get_valid_int_ans--crossover with--dataset/ETHPy150Open ipfs/py-ipfs-api/ipfsApi/client.py/Client.add_pyobj