code: def create(hypervisor, identifier, configuration):
      
      counter = count()
      xml_config = DEFAULT_NETWORK_XML
  
      if not {'configuration', 'dynamic_address'} & set(configuration.keys()):
          raise RuntimeError(
              "Either configuration or dynamic_address must be specified")
  
      if 'configuration' in configuration:
          with open(configuration['configuration']) as xml_file:
              xml_config = xml_file.read()
  
      while True:
          if 'dynamic_address' in configuration:
              address = generate_address(hypervisor,
                                         configuration['dynamic_address'])
              xml_string = network_xml(identifier, xml_config, address=address)
          else:
              xml_string = network_xml(identifier, xml_config)
  
          try:
              return hypervisor.networkCreateXML(xml_string)
          except libvirt.libvirtError as error:
              if next(counter) > MAX_ATTEMPTS:
                  raise RuntimeError(
                      "Exceeded failed attempts ({}) to get IP address.".format(
                          MAX_ATTEMPTS),
                      "Last error: {}".format(error))
docs: Creates a virtual network according to the given configuration.
  
      @param hypervisor: (libvirt.virConnect) connection to libvirt hypervisor.
      @param identifier: (str) UUID for the virtual network.
      @param configuration: (dict) network configuration.
  
      @return: (libvirt.virNetwork) virtual network.