class TwoOrThree(argparse._AppendAction):

    def __call__(self, parser, namespace, values, option_string=None):
        if not 2 <= len(values) <= 3:
            pass
Using the same option multiple times in Python's Argparse