prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Support create network EnableIPv6 and Labels options 
  Check the remote API:
  https://docs.docker.com/engine/reference/api/docker_remote_api_v1.23/#create-a-network
  
  There are two missing JSON parameters:
  
  ```
  EnableIPv6 - Enable IPv6 on the network
  Labels - Labels to set on the network, specified as a map: {"key":"value" [,"key2":"value2"]}
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `docker/api/network.py`
  Content:
  ```
  1 import json
  2 
  3 from ..errors import InvalidVersion
  4 from ..utils import check_resource, minimum_version
  5 from ..utils import version_lt
  6 
  7 
  8 class NetworkApiMixin(object):
  9     @minimum_version('1.21')
  10     def networks(self, names=None, ids=None):
  11         filters = {}
  12         if names:
  13             filters['name'] = names
  14         if ids:
  15             filters['id'] = ids
  16 
  17         params = {'filters': json.dumps(filters)}
  18 
  19         url = self._url("/networks")
  20         res = self._get(url, params=params)
  21         return self._result(res, json=True)
  22 
  23     @minimum_version('1.21')
  24     def create_network(self, name, driver=None, options=None, ipam=None,
  25                        check_duplicate=None, internal=False):
  26         if options is not None and not isinstance(options, dict):
  27             raise TypeError('options must be a dictionary')
  28 
  29         data = {
  30             'Name': name,
  31             'Driver': driver,
  32             'Options': options,
  33             'IPAM': ipam,
  34             'CheckDuplicate': check_duplicate
  35         }
  36 
  37         if internal:
  38             if version_lt(self._version, '1.22'):
  39                 raise InvalidVersion('Internal networks are not '
  40                                      'supported in API version < 1.22')
  41             data['Internal'] = True
  42 
  43         url = self._url("/networks/create")
  44         res = self._post_json(url, data=data)
  45         return self._result(res, json=True)
  46 
  47     @minimum_version('1.21')
  48     def remove_network(self, net_id):
  49         url = self._url("/networks/{0}", net_id)
  50         res = self._delete(url)
  51         self._raise_for_status(res)
  52 
  53     @minimum_version('1.21')
  54     def inspect_network(self, net_id):
  55         url = self._url("/networks/{0}", net_id)
  56         res = self._get(url)
  57         return self._result(res, json=True)
  58 
  59     @check_resource
  60     @minimum_version('1.21')
  61     def connect_container_to_network(self, container, net_id,
  62                                      ipv4_address=None, ipv6_address=None,
  63                                      aliases=None, links=None,
  64                                      link_local_ips=None):
  65         data = {
  66             "Container": container,
  67             "EndpointConfig": self.create_endpoint_config(
  68                 aliases=aliases, links=links, ipv4_address=ipv4_address,
  69                 ipv6_address=ipv6_address, link_local_ips=link_local_ips
  70             ),
  71         }
  72 
  73         url = self._url("/networks/{0}/connect", net_id)
  74         res = self._post_json(url, data=data)
  75         self._raise_for_status(res)
  76 
  77     @check_resource
  78     @minimum_version('1.21')
  79     def disconnect_container_from_network(self, container, net_id):
  80         data = {"container": container}
  81         url = self._url("/networks/{0}/disconnect", net_id)
  82         res = self._post_json(url, data=data)
  83         self._raise_for_status(res)
  84
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/docker/api/network.py b/docker/api/network.py
  --- a/docker/api/network.py
  +++ b/docker/api/network.py
  @@ -22,7 +22,8 @@
   
       @minimum_version('1.21')
       def create_network(self, name, driver=None, options=None, ipam=None,
  -                       check_duplicate=None, internal=False):
  +                       check_duplicate=None, internal=False, labels=None,
  +                       enable_ipv6=False):
           if options is not None and not isinstance(options, dict):
               raise TypeError('options must be a dictionary')
   
  @@ -34,6 +35,22 @@
               'CheckDuplicate': check_duplicate
           }
   
  +        if labels is not None:
  +            if version_lt(self._version, '1.23'):
  +                raise InvalidVersion(
  +                    'network labels were introduced in API 1.23'
  +                )
  +            if not isinstance(labels, dict):
  +                raise TypeError('labels must be a dictionary')
  +            data["Labels"] = labels
  +
  +        if enable_ipv6:
  +            if version_lt(self._version, '1.23'):
  +                raise InvalidVersion(
  +                    'enable_ipv6 was introduced in API 1.23'
  +                )
  +            data['EnableIPv6'] = True
  +
           if internal:
               if version_lt(self._version, '1.22'):
                   raise InvalidVersion('Internal networks are not '
  @@ -76,8 +93,15 @@
   
       @check_resource
       @minimum_version('1.21')
  -    def disconnect_container_from_network(self, container, net_id):
  -        data = {"container": container}
  +    def disconnect_container_from_network(self, container, net_id,
  +                                          force=False):
  +        data = {"Container": container}
  +        if force:
  +            if version_lt(self._version, '1.22'):
  +                raise InvalidVersion(
  +                    'Forced disconnect was introduced in API 1.22'
  +                )
  +            data['Force'] = force
           url = self._url("/networks/{0}/disconnect", net_id)
           res = self._post_json(url, data=data)
           self._raise_for_status(res)
  
verification_info: {"golden_diff": "diff --git a/docker/api/network.py b/docker/api/network.py\n--- a/docker/api/network.py\n+++ b/docker/api/network.py\n@@ -22,7 +22,8 @@\n \n     @minimum_version('1.21')\n     def create_network(self, name, driver=None, options=None, ipam=None,\n-                       check_duplicate=None, internal=False):\n+                       check_duplicate=None, internal=False, labels=None,\n+                       enable_ipv6=False):\n         if options is not None and not isinstance(options, dict):\n             raise TypeError('options must be a dictionary')\n \n@@ -34,6 +35,22 @@\n             'CheckDuplicate': check_duplicate\n         }\n \n+        if labels is not None:\n+            if version_lt(self._version, '1.23'):\n+                raise InvalidVersion(\n+                    'network labels were introduced in API 1.23'\n+                )\n+            if not isinstance(labels, dict):\n+                raise TypeError('labels must be a dictionary')\n+            data[\"Labels\"] = labels\n+\n+        if enable_ipv6:\n+            if version_lt(self._version, '1.23'):\n+                raise InvalidVersion(\n+                    'enable_ipv6 was introduced in API 1.23'\n+                )\n+            data['EnableIPv6'] = True\n+\n         if internal:\n             if version_lt(self._version, '1.22'):\n                 raise InvalidVersion('Internal networks are not '\n@@ -76,8 +93,15 @@\n \n     @check_resource\n     @minimum_version('1.21')\n-    def disconnect_container_from_network(self, container, net_id):\n-        data = {\"container\": container}\n+    def disconnect_container_from_network(self, container, net_id,\n+                                          force=False):\n+        data = {\"Container\": container}\n+        if force:\n+            if version_lt(self._version, '1.22'):\n+                raise InvalidVersion(\n+                    'Forced disconnect was introduced in API 1.22'\n+                )\n+            data['Force'] = force\n         url = self._url(\"/networks/{0}/disconnect\", net_id)\n         res = self._post_json(url, data=data)\n         self._raise_for_status(res)\n", "issue": "Support create network EnableIPv6 and Labels options \nCheck the remote API:\nhttps://docs.docker.com/engine/reference/api/docker_remote_api_v1.23/#create-a-network\n\nThere are two missing JSON parameters:\n\n```\nEnableIPv6 - Enable IPv6 on the network\nLabels - Labels to set on the network, specified as a map: {\"key\":\"value\" [,\"key2\":\"value2\"]}\n```\n\n", "before_files": [{"content": "import json\n\nfrom ..errors import InvalidVersion\nfrom ..utils import check_resource, minimum_version\nfrom ..utils import version_lt\n\n\nclass NetworkApiMixin(object):\n    @minimum_version('1.21')\n    def networks(self, names=None, ids=None):\n        filters = {}\n        if names:\n            filters['name'] = names\n        if ids:\n            filters['id'] = ids\n\n        params = {'filters': json.dumps(filters)}\n\n        url = self._url(\"/networks\")\n        res = self._get(url, params=params)\n        return self._result(res, json=True)\n\n    @minimum_version('1.21')\n    def create_network(self, name, driver=None, options=None, ipam=None,\n                       check_duplicate=None, internal=False):\n        if options is not None and not isinstance(options, dict):\n            raise TypeError('options must be a dictionary')\n\n        data = {\n            'Name': name,\n            'Driver': driver,\n            'Options': options,\n            'IPAM': ipam,\n            'CheckDuplicate': check_duplicate\n        }\n\n        if internal:\n            if version_lt(self._version, '1.22'):\n                raise InvalidVersion('Internal networks are not '\n                                     'supported in API version < 1.22')\n            data['Internal'] = True\n\n        url = self._url(\"/networks/create\")\n        res = self._post_json(url, data=data)\n        return self._result(res, json=True)\n\n    @minimum_version('1.21')\n    def remove_network(self, net_id):\n        url = self._url(\"/networks/{0}\", net_id)\n        res = self._delete(url)\n        self._raise_for_status(res)\n\n    @minimum_version('1.21')\n    def inspect_network(self, net_id):\n        url = self._url(\"/networks/{0}\", net_id)\n        res = self._get(url)\n        return self._result(res, json=True)\n\n    @check_resource\n    @minimum_version('1.21')\n    def connect_container_to_network(self, container, net_id,\n                                     ipv4_address=None, ipv6_address=None,\n                                     aliases=None, links=None,\n                                     link_local_ips=None):\n        data = {\n            \"Container\": container,\n            \"EndpointConfig\": self.create_endpoint_config(\n                aliases=aliases, links=links, ipv4_address=ipv4_address,\n                ipv6_address=ipv6_address, link_local_ips=link_local_ips\n            ),\n        }\n\n        url = self._url(\"/networks/{0}/connect\", net_id)\n        res = self._post_json(url, data=data)\n        self._raise_for_status(res)\n\n    @check_resource\n    @minimum_version('1.21')\n    def disconnect_container_from_network(self, container, net_id):\n        data = {\"container\": container}\n        url = self._url(\"/networks/{0}/disconnect\", net_id)\n        res = self._post_json(url, data=data)\n        self._raise_for_status(res)\n", "path": "docker/api/network.py"}], "after_files": [{"content": "import json\n\nfrom ..errors import InvalidVersion\nfrom ..utils import check_resource, minimum_version\nfrom ..utils import version_lt\n\n\nclass NetworkApiMixin(object):\n    @minimum_version('1.21')\n    def networks(self, names=None, ids=None):\n        filters = {}\n        if names:\n            filters['name'] = names\n        if ids:\n            filters['id'] = ids\n\n        params = {'filters': json.dumps(filters)}\n\n        url = self._url(\"/networks\")\n        res = self._get(url, params=params)\n        return self._result(res, json=True)\n\n    @minimum_version('1.21')\n    def create_network(self, name, driver=None, options=None, ipam=None,\n                       check_duplicate=None, internal=False, labels=None,\n                       enable_ipv6=False):\n        if options is not None and not isinstance(options, dict):\n            raise TypeError('options must be a dictionary')\n\n        data = {\n            'Name': name,\n            'Driver': driver,\n            'Options': options,\n            'IPAM': ipam,\n            'CheckDuplicate': check_duplicate\n        }\n\n        if labels is not None:\n            if version_lt(self._version, '1.23'):\n                raise InvalidVersion(\n                    'network labels were introduced in API 1.23'\n                )\n            if not isinstance(labels, dict):\n                raise TypeError('labels must be a dictionary')\n            data[\"Labels\"] = labels\n\n        if enable_ipv6:\n            if version_lt(self._version, '1.23'):\n                raise InvalidVersion(\n                    'enable_ipv6 was introduced in API 1.23'\n                )\n            data['EnableIPv6'] = True\n\n        if internal:\n            if version_lt(self._version, '1.22'):\n                raise InvalidVersion('Internal networks are not '\n                                     'supported in API version < 1.22')\n            data['Internal'] = True\n\n        url = self._url(\"/networks/create\")\n        res = self._post_json(url, data=data)\n        return self._result(res, json=True)\n\n    @minimum_version('1.21')\n    def remove_network(self, net_id):\n        url = self._url(\"/networks/{0}\", net_id)\n        res = self._delete(url)\n        self._raise_for_status(res)\n\n    @minimum_version('1.21')\n    def inspect_network(self, net_id):\n        url = self._url(\"/networks/{0}\", net_id)\n        res = self._get(url)\n        return self._result(res, json=True)\n\n    @check_resource\n    @minimum_version('1.21')\n    def connect_container_to_network(self, container, net_id,\n                                     ipv4_address=None, ipv6_address=None,\n                                     aliases=None, links=None,\n                                     link_local_ips=None):\n        data = {\n            \"Container\": container,\n            \"EndpointConfig\": self.create_endpoint_config(\n                aliases=aliases, links=links, ipv4_address=ipv4_address,\n                ipv6_address=ipv6_address, link_local_ips=link_local_ips\n            ),\n        }\n\n        url = self._url(\"/networks/{0}/connect\", net_id)\n        res = self._post_json(url, data=data)\n        self._raise_for_status(res)\n\n    @check_resource\n    @minimum_version('1.21')\n    def disconnect_container_from_network(self, container, net_id,\n                                          force=False):\n        data = {\"Container\": container}\n        if force:\n            if version_lt(self._version, '1.22'):\n                raise InvalidVersion(\n                    'Forced disconnect was introduced in API 1.22'\n                )\n            data['Force'] = force\n        url = self._url(\"/networks/{0}/disconnect\", net_id)\n        res = self._post_json(url, data=data)\n        self._raise_for_status(res)\n", "path": "docker/api/network.py"}]}