<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def num_mode_groups(self):
 		"""Most devices only provide a single mode group, however devices 		such as the Wacom Cintiq 22HD provide two mode groups. 		If multiple mode groups are available, a caller should use 		:meth:`~libinput.define.TabletPadModeGroup.has_button`, 		:meth:`~libinput.define.TabletPadModeGroup.has_ring` 		and :meth:`~libinput.define.TabletPadModeGroup.has_strip` to associate 		each button, ring and strip with the correct mode group. 		Returns: 			int: The number of mode groups available on this device. 		Raises: 			AttributeError 		"""


		num = self._libinput.libinput_device_tablet_pad_get_num_mode_groups(
			self._handle)
		if num < 0:
			raise AttributeError('This device is not a tablet pad device')
		return num