def positive_integer(value):
 try:
  value = int(value)
 except Exception:
  raise argparse.ArgumentTypeError("Invalid int value: '{}'".format(value))
 if (value < 0):
  raise argparse.ArgumentTypeError("Invalid positive int value: '{}'".format(value))
 return value

def positive_integer ( value ) : try : value = int ( value ) except Exception : raise argparse . ArgumentTypeError ( "Invalid int value: '{}'" . format ( value ) ) if ( value < 0 ) : raise argparse . ArgumentTypeError ( "Invalid positive int value: '{}'" . format ( value ) ) return value
ensures that the provided value is a positive integer .