prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add docker network IPAM options parameter
  IPAM driver missing options
  
  supports an options field in the IPAM config 
  It introduced in API v1.22.
  
  ```
  POST /networks/create Now supports an options field in the IPAM config that provides options for custom IPAM plugins.
  ```
  
  
  --- 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/types/networks.py`
  Content:
  ```
  1 from .. import errors
  2 from ..utils import normalize_links, version_lt
  3 
  4 
  5 class EndpointConfig(dict):
  6     def __init__(self, version, aliases=None, links=None, ipv4_address=None,
  7                  ipv6_address=None, link_local_ips=None):
  8         if version_lt(version, '1.22'):
  9             raise errors.InvalidVersion(
  10                 'Endpoint config is not supported for API version < 1.22'
  11             )
  12 
  13         if aliases:
  14             self["Aliases"] = aliases
  15 
  16         if links:
  17             self["Links"] = normalize_links(links)
  18 
  19         ipam_config = {}
  20         if ipv4_address:
  21             ipam_config['IPv4Address'] = ipv4_address
  22 
  23         if ipv6_address:
  24             ipam_config['IPv6Address'] = ipv6_address
  25 
  26         if link_local_ips is not None:
  27             if version_lt(version, '1.24'):
  28                 raise errors.InvalidVersion(
  29                     'link_local_ips is not supported for API version < 1.24'
  30                 )
  31             ipam_config['LinkLocalIPs'] = link_local_ips
  32 
  33         if ipam_config:
  34             self['IPAMConfig'] = ipam_config
  35 
  36 
  37 class NetworkingConfig(dict):
  38     def __init__(self, endpoints_config=None):
  39         if endpoints_config:
  40             self["EndpointsConfig"] = endpoints_config
  41 
  42 
  43 class IPAMConfig(dict):
  44     """
  45     Create an IPAM (IP Address Management) config dictionary to be used with
  46     :py:meth:`~docker.api.network.NetworkApiMixin.create_network`.
  47 
  48     Args:
  49 
  50         driver (str): The IPAM driver to use. Defaults to ``default``.
  51         pool_configs (list): A list of pool configurations
  52           (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.
  53 
  54     Example:
  55 
  56         >>> ipam_config = docker.types.IPAMConfig(driver='default')
  57         >>> network = client.create_network('network1', ipam=ipam_config)
  58 
  59     """
  60     def __init__(self, driver='default', pool_configs=None):
  61         self.update({
  62             'Driver': driver,
  63             'Config': pool_configs or []
  64         })
  65 
  66 
  67 class IPAMPool(dict):
  68     """
  69     Create an IPAM pool config dictionary to be added to the
  70     ``pool_configs`` parameter of
  71     :py:class:`~docker.types.IPAMConfig`.
  72 
  73     Args:
  74 
  75         subnet (str): Custom subnet for this IPAM pool using the CIDR
  76             notation. Defaults to ``None``.
  77         iprange (str): Custom IP range for endpoints in this IPAM pool using
  78             the CIDR notation. Defaults to ``None``.
  79         gateway (str): Custom IP address for the pool's gateway.
  80         aux_addresses (dict): A dictionary of ``key -> ip_address``
  81             relationships specifying auxiliary addresses that need to be
  82             allocated by the IPAM driver.
  83 
  84     Example:
  85 
  86         >>> ipam_pool = docker.types.IPAMPool(
  87             subnet='124.42.0.0/16',
  88             iprange='124.42.0.0/24',
  89             gateway='124.42.0.254',
  90             aux_addresses={
  91                 'reserved1': '124.42.1.1'
  92             }
  93         )
  94         >>> ipam_config = docker.types.IPAMConfig(
  95                 pool_configs=[ipam_pool])
  96     """
  97     def __init__(self, subnet=None, iprange=None, gateway=None,
  98                  aux_addresses=None):
  99         self.update({
  100             'Subnet': subnet,
  101             'IPRange': iprange,
  102             'Gateway': gateway,
  103             'AuxiliaryAddresses': aux_addresses
  104         })
  105
  ```
  --- 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/types/networks.py b/docker/types/networks.py
  --- a/docker/types/networks.py
  +++ b/docker/types/networks.py
  @@ -50,6 +50,8 @@
           driver (str): The IPAM driver to use. Defaults to ``default``.
           pool_configs (list): A list of pool configurations
             (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.
  +        options (dict): Driver options as a key-value dictionary.
  +          Defaults to `None`.
   
       Example:
   
  @@ -57,12 +59,17 @@
           >>> network = client.create_network('network1', ipam=ipam_config)
   
       """
  -    def __init__(self, driver='default', pool_configs=None):
  +    def __init__(self, driver='default', pool_configs=None, options=None):
           self.update({
               'Driver': driver,
               'Config': pool_configs or []
           })
   
  +        if options:
  +            if not isinstance(options, dict):
  +                raise TypeError('IPAMConfig options must be a dictionary')
  +            self['Options'] = options
  +
   
   class IPAMPool(dict):
       """
  
verification_info: {"golden_diff": "diff --git a/docker/types/networks.py b/docker/types/networks.py\n--- a/docker/types/networks.py\n+++ b/docker/types/networks.py\n@@ -50,6 +50,8 @@\n         driver (str): The IPAM driver to use. Defaults to ``default``.\n         pool_configs (list): A list of pool configurations\n           (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.\n+        options (dict): Driver options as a key-value dictionary.\n+          Defaults to `None`.\n \n     Example:\n \n@@ -57,12 +59,17 @@\n         >>> network = client.create_network('network1', ipam=ipam_config)\n \n     \"\"\"\n-    def __init__(self, driver='default', pool_configs=None):\n+    def __init__(self, driver='default', pool_configs=None, options=None):\n         self.update({\n             'Driver': driver,\n             'Config': pool_configs or []\n         })\n \n+        if options:\n+            if not isinstance(options, dict):\n+                raise TypeError('IPAMConfig options must be a dictionary')\n+            self['Options'] = options\n+\n \n class IPAMPool(dict):\n     \"\"\"\n", "issue": "Add docker network IPAM options parameter\nIPAM driver missing options\n\nsupports an options field in the IPAM config \nIt introduced in API v1.22.\n\n```\nPOST /networks/create Now supports an options field in the IPAM config that provides options for custom IPAM plugins.\n```\n\n", "before_files": [{"content": "from .. import errors\nfrom ..utils import normalize_links, version_lt\n\n\nclass EndpointConfig(dict):\n    def __init__(self, version, aliases=None, links=None, ipv4_address=None,\n                 ipv6_address=None, link_local_ips=None):\n        if version_lt(version, '1.22'):\n            raise errors.InvalidVersion(\n                'Endpoint config is not supported for API version < 1.22'\n            )\n\n        if aliases:\n            self[\"Aliases\"] = aliases\n\n        if links:\n            self[\"Links\"] = normalize_links(links)\n\n        ipam_config = {}\n        if ipv4_address:\n            ipam_config['IPv4Address'] = ipv4_address\n\n        if ipv6_address:\n            ipam_config['IPv6Address'] = ipv6_address\n\n        if link_local_ips is not None:\n            if version_lt(version, '1.24'):\n                raise errors.InvalidVersion(\n                    'link_local_ips is not supported for API version < 1.24'\n                )\n            ipam_config['LinkLocalIPs'] = link_local_ips\n\n        if ipam_config:\n            self['IPAMConfig'] = ipam_config\n\n\nclass NetworkingConfig(dict):\n    def __init__(self, endpoints_config=None):\n        if endpoints_config:\n            self[\"EndpointsConfig\"] = endpoints_config\n\n\nclass IPAMConfig(dict):\n    \"\"\"\n    Create an IPAM (IP Address Management) config dictionary to be used with\n    :py:meth:`~docker.api.network.NetworkApiMixin.create_network`.\n\n    Args:\n\n        driver (str): The IPAM driver to use. Defaults to ``default``.\n        pool_configs (list): A list of pool configurations\n          (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.\n\n    Example:\n\n        >>> ipam_config = docker.types.IPAMConfig(driver='default')\n        >>> network = client.create_network('network1', ipam=ipam_config)\n\n    \"\"\"\n    def __init__(self, driver='default', pool_configs=None):\n        self.update({\n            'Driver': driver,\n            'Config': pool_configs or []\n        })\n\n\nclass IPAMPool(dict):\n    \"\"\"\n    Create an IPAM pool config dictionary to be added to the\n    ``pool_configs`` parameter of\n    :py:class:`~docker.types.IPAMConfig`.\n\n    Args:\n\n        subnet (str): Custom subnet for this IPAM pool using the CIDR\n            notation. Defaults to ``None``.\n        iprange (str): Custom IP range for endpoints in this IPAM pool using\n            the CIDR notation. Defaults to ``None``.\n        gateway (str): Custom IP address for the pool's gateway.\n        aux_addresses (dict): A dictionary of ``key -> ip_address``\n            relationships specifying auxiliary addresses that need to be\n            allocated by the IPAM driver.\n\n    Example:\n\n        >>> ipam_pool = docker.types.IPAMPool(\n            subnet='124.42.0.0/16',\n            iprange='124.42.0.0/24',\n            gateway='124.42.0.254',\n            aux_addresses={\n                'reserved1': '124.42.1.1'\n            }\n        )\n        >>> ipam_config = docker.types.IPAMConfig(\n                pool_configs=[ipam_pool])\n    \"\"\"\n    def __init__(self, subnet=None, iprange=None, gateway=None,\n                 aux_addresses=None):\n        self.update({\n            'Subnet': subnet,\n            'IPRange': iprange,\n            'Gateway': gateway,\n            'AuxiliaryAddresses': aux_addresses\n        })\n", "path": "docker/types/networks.py"}], "after_files": [{"content": "from .. import errors\nfrom ..utils import normalize_links, version_lt\n\n\nclass EndpointConfig(dict):\n    def __init__(self, version, aliases=None, links=None, ipv4_address=None,\n                 ipv6_address=None, link_local_ips=None):\n        if version_lt(version, '1.22'):\n            raise errors.InvalidVersion(\n                'Endpoint config is not supported for API version < 1.22'\n            )\n\n        if aliases:\n            self[\"Aliases\"] = aliases\n\n        if links:\n            self[\"Links\"] = normalize_links(links)\n\n        ipam_config = {}\n        if ipv4_address:\n            ipam_config['IPv4Address'] = ipv4_address\n\n        if ipv6_address:\n            ipam_config['IPv6Address'] = ipv6_address\n\n        if link_local_ips is not None:\n            if version_lt(version, '1.24'):\n                raise errors.InvalidVersion(\n                    'link_local_ips is not supported for API version < 1.24'\n                )\n            ipam_config['LinkLocalIPs'] = link_local_ips\n\n        if ipam_config:\n            self['IPAMConfig'] = ipam_config\n\n\nclass NetworkingConfig(dict):\n    def __init__(self, endpoints_config=None):\n        if endpoints_config:\n            self[\"EndpointsConfig\"] = endpoints_config\n\n\nclass IPAMConfig(dict):\n    \"\"\"\n    Create an IPAM (IP Address Management) config dictionary to be used with\n    :py:meth:`~docker.api.network.NetworkApiMixin.create_network`.\n\n    Args:\n\n        driver (str): The IPAM driver to use. Defaults to ``default``.\n        pool_configs (list): A list of pool configurations\n          (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.\n        options (dict): Driver options as a key-value dictionary.\n          Defaults to `None`.\n\n    Example:\n\n        >>> ipam_config = docker.types.IPAMConfig(driver='default')\n        >>> network = client.create_network('network1', ipam=ipam_config)\n\n    \"\"\"\n    def __init__(self, driver='default', pool_configs=None, options=None):\n        self.update({\n            'Driver': driver,\n            'Config': pool_configs or []\n        })\n\n        if options:\n            if not isinstance(options, dict):\n                raise TypeError('IPAMConfig options must be a dictionary')\n            self['Options'] = options\n\n\nclass IPAMPool(dict):\n    \"\"\"\n    Create an IPAM pool config dictionary to be added to the\n    ``pool_configs`` parameter of\n    :py:class:`~docker.types.IPAMConfig`.\n\n    Args:\n\n        subnet (str): Custom subnet for this IPAM pool using the CIDR\n            notation. Defaults to ``None``.\n        iprange (str): Custom IP range for endpoints in this IPAM pool using\n            the CIDR notation. Defaults to ``None``.\n        gateway (str): Custom IP address for the pool's gateway.\n        aux_addresses (dict): A dictionary of ``key -> ip_address``\n            relationships specifying auxiliary addresses that need to be\n            allocated by the IPAM driver.\n\n    Example:\n\n        >>> ipam_pool = docker.types.IPAMPool(\n            subnet='124.42.0.0/16',\n            iprange='124.42.0.0/24',\n            gateway='124.42.0.254',\n            aux_addresses={\n                'reserved1': '124.42.1.1'\n            }\n        )\n        >>> ipam_config = docker.types.IPAMConfig(\n                pool_configs=[ipam_pool])\n    \"\"\"\n    def __init__(self, subnet=None, iprange=None, gateway=None,\n                 aux_addresses=None):\n        self.update({\n            'Subnet': subnet,\n            'IPRange': iprange,\n            'Gateway': gateway,\n            'AuxiliaryAddresses': aux_addresses\n        })\n", "path": "docker/types/networks.py"}]}