'Create networks based on parameters.'

def create_networks(self, context, **kwargs):

    self._convert_int_args(kwargs)
    kwargs['vlan_start'] = (kwargs.get('vlan_start') or CONF.vlan_start)
    kwargs['num_networks'] = (kwargs.get('num_networks') or CONF.num_networks)
    kwargs['network_size'] = (kwargs.get('network_size') or CONF.network_size)
    if ((kwargs['num_networks'] + kwargs['vlan_start']) > 4094):
        raise ValueError(_('The    sum    between    the    number    of    networks    and    the    vlan    start    cannot    be    greater    than    4094'))
    vlan_num = kwargs.get('vlan', None)
    if (vlan_num is not None):
        try:
            vlan_num = int(vlan_num)
        except ValueError:
            raise ValueError(_('vlan    must    be    an    integer'))
        if (vlan_num > 4094):
            raise ValueError(_('The    vlan    number    cannot    be    greater    than    4094'))
        if (vlan_num < 1):
            raise ValueError(_('The    vlan    number    cannot    be    less    than    1'))
    fixed_net = netaddr.IPNetwork(kwargs['cidr'])
    if (fixed_net.size < (kwargs['num_networks'] * kwargs['network_size'])):
        raise ValueError((_('The    network    range    is    not    big    enough    to    fit    %(num_networks)s    networks.    Network    size    is    %(network_size)s') % kwargs))
    kwargs['bridge_interface'] = (kwargs.get('bridge_interface') or CONF.vlan_interface)
    LOG.debug('Create    network:    |%s|', kwargs)
    return NetworkManager.create_networks(self, context, vpn=True, **kwargs)
