<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_add_loopback():
 """ Validate params when adding a loopback adapter """


    class Add(argparse.Action):

        def __call__(self, parser, args, values, option_string=None):
            try:
                ipaddress.IPv4Interface("{}/{}".format(values[1], values[2]))
            except ipaddress.AddressValueError as e:
                raise argparse.ArgumentTypeError("Invalid IP address: {}".format(e))
            except ipaddress.NetmaskValueError as e:
                raise argparse.ArgumentTypeError("Invalid subnet mask: {}".format(e))
            setattr(args, self.dest, values)
    return Add