code: def main(jlink_serial, device):
      
      buf = StringIO.StringIO()
      jlink = pylink.JLink(log=buf.write, detailed_log=buf.write)
      jlink.open(serial_no=jlink_serial)
  
      # Use Serial Wire Debug as the target interface.
      jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
      jlink.connect(device, verbose=True)
  
      sys.stdout.write('ARM Id: %d\n' % jlink.core_id())
      sys.stdout.write('CPU Id: %d\n' % jlink.core_cpu())
      sys.stdout.write('Core Name: %s\n' % jlink.core_name())
      sys.stdout.write('Device Family: %d\n' % jlink.device_family())
docs: Prints the core's information.
  
      Args:
        jlink_serial (str): the J-Link serial number
        device (str): the target CPU
  
      Returns:
        Always returns ``0``.
  
      Raises:
        JLinkException: on error