<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def channel_group(self, **kwargs):
 """set channel group mode. args: int_type (str):
 type of interface. (gigabitethernet, tengigabitethernet, etc) name (str):
 name of interface. (1/0/5, 1/0/10, etc) port_int (str):
 port-channel number (1, 2, 3, etc). channel_type (str):
 tiype of port-channel (standard, brocade) mode (str):
 mode of channel group (active, on, passive). delete (bool):
 Removes channel group configuration from this interface if `delete` is ``True``. callback (function):
 a function executed upon completion of the method. the only parameter passed to `callback` will be the ``elementtree`` `config`. returns: return value of `callback`. raises: keyerror: if `int_type`, `name`, or `description` is not specified. valueerror: if `name` or `int_type` are not valid values. examples: Traceback (most recent call last):
 KeyError """

        int_type = kwargs.pop('int_type').lower()
        name = kwargs.pop('name')
        channel_type = kwargs.pop('channel_type')
        port_int = kwargs.pop('port_int')
        mode = kwargs.pop('mode')
        delete = kwargs.pop('delete', False)
        callback = kwargs.pop('callback', self._callback)

        int_types = [
            'gigabitethernet',
            'tengigabitethernet',
            'fortygigabitethernet',
            'hundredgigabitethernet'
        ]

        if int_type not in int_types:
            raise ValueError("`int_type` must be one of: %s" % repr(int_types))

        valid_modes = ['active', 'on', 'passive']

        if mode not in valid_modes:
            raise ValueError("`mode` must be one of: %s" % repr(valid_modes))

        valid_types = ['brocade', 'standard']

        if channel_type not in valid_types:
            raise ValueError("`channel_type` must be one of: %s" %
                             repr(valid_types))

        if not pynos.utilities.valid_interface('port_channel', port_int):
            raise ValueError("incorrect port_int value.")

        channel_group_args = dict(name=name, mode=mode)

        if not pynos.utilities.valid_interface(int_type, name):
            raise ValueError("incorrect name value.")

        config = getattr(
            self._interface,
            'interface_%s_channel_group_mode' % int_type
        )(**channel_group_args)

        channel_group = config.find('.//*channel-group')
        if delete is True:
            channel_group.set('operation', 'delete')
        else:
            ET.SubElement(channel_group, 'port-int').text = port_int
            ET.SubElement(channel_group, 'type').text = channel_type

        return callback(config)