docs: def guest_create_network_interface(self, userid, os_version,
                                         guest_networks, active=False):
          """ Create network interface(s) for the guest inux system. It will
              create the nic for the guest, add NICDEF record into the user
              direct. It will also construct network interface configuration
              files and punch the files to the guest. These files will take
              effect when initializing and configure guest.
  
          :param str userid: the user id of the guest
          :param str os_version: operating system version of the guest
          :param list guest_networks: a list of network info for the guest.
                 It has one dictionary that contain some of the below keys for
                 each network, the format is:
                 {'ip_addr': (str) IP address or None,
                 'dns_addr': (list) dns addresses or None,
                 'gateway_addr': (str) gateway address or None,
                 'cidr': (str) cidr format,
                 'nic_vdev': (str)nic VDEV, 1- to 4- hexadecimal digits or None,
                 'nic_id': (str) nic identifier or None,
                 'mac_addr': (str) mac address or None, it is only be used when
                 changing the guest's user direct. Format should be
                 xx:xx:xx:xx:xx:xx, and x is a hexadecimal digit
                 'osa_device': (str) OSA address or None}
  
                 Example for guest_networks:
                 [{'ip_addr': '192.168.95.10',
                 'dns_addr': ['9.0.2.1', '9.0.3.1'],
                 'gateway_addr': '192.168.95.1',
                 'cidr': "192.168.95.0/24",
                 'nic_vdev': '1000',
                 'mac_addr': '02:00:00:12:34:56'},
                 {'ip_addr': '192.168.96.10',
                 'dns_addr': ['9.0.2.1', '9.0.3.1'],
                 'gateway_addr': '192.168.96.1',
                 'cidr': "192.168.96.0/24",
                 'nic_vdev': '1003}]
          :param bool active: whether add a nic on active guest system
          :returns: guest_networks list, including nic_vdev for each network
          :rtype: list
          """
          if len(guest_networks) == 0:
              errmsg = ("API guest_create_network_interface: "
                        "Network information is required but not provided")
              raise exception.SDKInvalidInputFormat(msg=errmsg)
  
          for network in guest_networks:
              vdev = nic_id = mac_addr = ip_addr = OSA = None
              if 'nic_vdev' in network.keys():
                  vdev = network['nic_vdev']
              if 'osa_device' in network.keys():
                  OSA = network['osa_device']
              if 'nic_id' in network.keys():
                  nic_id = network['nic_id']
  
              if (('mac_addr' in network.keys()) and
                  (network['mac_addr'] is not None)):
                  mac_addr = network['mac_addr']
                  if not zvmutils.valid_mac_addr(mac_addr):
                      errmsg = ("API guest_create_network_interface: "
                                "Invalid mac address, format should be "
                                "xx:xx:xx:xx:xx:xx, and x is a hexadecimal "
                                "digit")
                      raise exception.SDKInvalidInputFormat(msg=errmsg)
  
              if (('ip_addr' in network.keys()) and
                  (network['ip_addr'] is not None)):
                  ip_addr = network['ip_addr']
                  if not netaddr.valid_ipv4(ip_addr):
                      errmsg = ("API guest_create_network_interface: "
                                "Invalid management IP address, it should be "
                                "the value between 0.0.0.0 and 255.255.255.255")
                      raise exception.SDKInvalidInputFormat(msg=errmsg)
  
              if (('dns_addr' in network.keys()) and
                  (network['dns_addr'] is not None)):
                  if not isinstance(network['dns_addr'], list):
                      raise exception.SDKInvalidInputTypes(
                          'guest_config_network',
                          str(list), str(type(network['dns_addr'])))
                  for dns in network['dns_addr']:
                      if not netaddr.valid_ipv4(dns):
                          errmsg = ("API guest_create_network_interface: "
                                    "Invalid dns IP address, it should be the "
                                    "value between 0.0.0.0 and 255.255.255.255")
                          raise exception.SDKInvalidInputFormat(msg=errmsg)
  
              if (('gateway_addr' in network.keys()) and
                  (network['gateway_addr'] is not None)):
                  if not netaddr.valid_ipv4(
                                      network['gateway_addr']):
                      errmsg = ("API guest_create_network_interface: "
                                "Invalid gateway IP address, it should be "
                                "the value between 0.0.0.0 and 255.255.255.255")
                      raise exception.SDKInvalidInputFormat(msg=errmsg)
              if (('cidr' in network.keys()) and
                  (network['cidr'] is not None)):
                  if not zvmutils.valid_cidr(network['cidr']):
                      errmsg = ("API guest_create_network_interface: "
                                "Invalid CIDR, format should be a.b.c.d/n, and "
                                "a.b.c.d is IP address, n is the value "
                                "between 0-32")
                      raise exception.SDKInvalidInputFormat(msg=errmsg)
  
              try:
                  if OSA is None:
                      used_vdev = self._networkops.create_nic(userid, vdev=vdev,
                                                              nic_id=nic_id,
                                                              mac_addr=mac_addr,
                                                              active=active)
                  else:
                      used_vdev = self._networkops.dedicate_OSA(userid, OSA,
                                                                vdev=vdev,
                                                                active=active)
                  network['nic_vdev'] = used_vdev
              except exception.SDKBaseException:
                  LOG.error(('Failed to create nic on vm %s') % userid)
                  raise
  
          try:
              self._networkops.network_configuration(userid, os_version,
                                                     guest_networks,
                                                     active=active)
          except exception.SDKBaseException:
              LOG.error(('Failed to set network configuration file on vm %s') %
                        userid)
              raise
          return guest_networks