argparse accept only few options

...
parser.add_argument('--val',
                    choices=['a', 'b', 'c'],
                    help='Special testing value')

args = parser.parse_args(sys.argv[1:])

Here is what the above code is Doing:
1. We’re creating a parser object.
2. We’re adding an argument to the parser object.
3. We’re telling the parser object to parse the command line arguments.
4. We’re storing the parsed arguments in a variable.