def METHOD_NAME(op, expand=False, minargs=1):
    class _action(argparse.Action):
        def __call__(self, parser, namespace, values, option_string=None):
            if len(values) < minargs:
                raise argparse.ArgumentError(self, "not enough parameters")
            if expand:
                pin = values[0]
                for v in values[1:]:
                    namespace.ops.append([op, pin, v])
            else:
                namespace.ops.append([op]+values)
    return _action