<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_net_configuration(self, ipv4_address=None, ipv4_configuration=None, ipv4_gateway=None, channel=None):
 """Set network configuration data. Apply desired network configuration data, leaving unspecified parameters alone. :param ipv4_address: CIDR notation for IP address and netmask Example: '192.168.0.10/16' :param ipv4_configuration: Method to use to configure the network. 'DHCP' or 'Static'. :param ipv4_gateway: IP address of gateway to use. :param channel: LAN channel to configure, defaults to autodetect """

        if channel is None:
            channel = self.get_network_channel()
        if ipv4_configuration is not None:
            cmddata = [channel, 4, 0]
            if ipv4_configuration.lower() == 'dhcp':
                cmddata[-1] = 2
            elif ipv4_configuration.lower() == 'static':
                cmddata[-1] = 1
            else:
                raise Exception('Unrecognized ipv4cfg parameter {0}'.format(
                    ipv4_configuration))
            self.xraw_command(netfn=0xc, command=1, data=cmddata)
        if ipv4_address is not None:
            netmask = None
            if '/' in ipv4_address:
                ipv4_address, prefix = ipv4_address.split('/')
                netmask = _cidr_to_mask(int(prefix))
            cmddata = bytearray((channel, 3)) + socket.inet_aton(ipv4_address)
            self.xraw_command(netfn=0xc, command=1, data=cmddata)
            if netmask is not None:
                cmddata = bytearray((channel, 6)) + netmask
                self.xraw_command(netfn=0xc, command=1, data=cmddata)
        if ipv4_gateway is not None:
            cmddata = bytearray((channel, 12)) + socket.inet_aton(ipv4_gateway)
            self.xraw_command(netfn=0xc, command=1, data=cmddata)