<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_common_arguments(self, parser, has_device=False):
 """Adds common arguments to the given parser. Common arguments for a J-Link command are the target interface, and J-Link serial number or IP address. Args: self (Command):
 the ``Command`` instance parser (argparse.ArgumentParser):
 the parser to add the arguments to has_device (bool):
 boolean indicating if it has the device argument Returns: ``None`` """

        if has_device:
            parser.add_argument('-t', '--tif', required=True,
                                type=str.lower, choices=['jtag', 'swd'],
                                help='target interface (JTAG | SWD)')
            parser.add_argument('-d', '--device', required=True,
                                help='specify the target device name')

        group = parser.add_mutually_exclusive_group(required=False)
        group.add_argument('-s', '--serial', dest='serial_no',
                           help='specify the J-Link serial number')
        group.add_argument('-i', '--ip_addr', dest='ip_addr',
                           help='J-Link IP address')

        return None