prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  CertTypes `keyfile` and `password` should be Optional types.
  `SSLContext.load_cert_chain` can take `None` as arguments values ([docs](https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_cert_chain)) so I guess this:
  https://github.com/encode/httpx/blob/c09e61d50c8f169187cada6dbf14b89c7763c63f/httpx/_types.py#L54
  should be rewritten as follows:
  ```python
  CertTypes = Union[str, Tuple[str, Optional[str]], Tuple[str, Optional[str], Optional[str]]] 
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `httpx/_types.py`
  Content:
  ```
  1 """
  2 Type definitions for type checking purposes.
  3 """
  4 
  5 import ssl
  6 from http.cookiejar import CookieJar
  7 from typing import (
  8     IO,
  9     TYPE_CHECKING,
  10     AsyncIterable,
  11     Callable,
  12     Dict,
  13     Iterable,
  14     List,
  15     Mapping,
  16     Optional,
  17     Sequence,
  18     Tuple,
  19     Union,
  20 )
  21 
  22 if TYPE_CHECKING:  # pragma: no cover
  23     from ._auth import Auth  # noqa: F401
  24     from ._config import Proxy, Timeout  # noqa: F401
  25     from ._models import URL, Cookies, Headers, QueryParams, Request  # noqa: F401
  26 
  27 
  28 PrimitiveData = Optional[Union[str, int, float, bool]]
  29 
  30 RawURL = Tuple[bytes, bytes, Optional[int], bytes]
  31 
  32 URLTypes = Union["URL", str]
  33 
  34 QueryParamTypes = Union[
  35     "QueryParams",
  36     Mapping[str, Union[PrimitiveData, Sequence[PrimitiveData]]],
  37     List[Tuple[str, PrimitiveData]],
  38     Tuple[Tuple[str, PrimitiveData], ...],
  39     str,
  40     bytes,
  41     None,
  42 ]
  43 
  44 HeaderTypes = Union[
  45     "Headers",
  46     Dict[str, str],
  47     Dict[bytes, bytes],
  48     Sequence[Tuple[str, str]],
  49     Sequence[Tuple[bytes, bytes]],
  50 ]
  51 
  52 CookieTypes = Union["Cookies", CookieJar, Dict[str, str], List[Tuple[str, str]]]
  53 
  54 CertTypes = Union[str, Tuple[str, str], Tuple[str, str, str]]
  55 VerifyTypes = Union[str, bool, ssl.SSLContext]
  56 TimeoutTypes = Union[
  57     Optional[float],
  58     Tuple[Optional[float], Optional[float], Optional[float], Optional[float]],
  59     "Timeout",
  60 ]
  61 ProxiesTypes = Union[URLTypes, "Proxy", Dict[URLTypes, Union[None, URLTypes, "Proxy"]]]
  62 
  63 AuthTypes = Union[
  64     Tuple[Union[str, bytes], Union[str, bytes]],
  65     Callable[["Request"], "Request"],
  66     "Auth",
  67     None,
  68 ]
  69 
  70 ByteStream = Union[Iterable[bytes], AsyncIterable[bytes]]
  71 RequestContent = Union[str, bytes, ByteStream]
  72 ResponseContent = Union[str, bytes, ByteStream]
  73 
  74 RequestData = dict
  75 
  76 FileContent = Union[IO[str], IO[bytes], str, bytes]
  77 FileTypes = Union[
  78     # file (or text)
  79     FileContent,
  80     # (filename, file (or text))
  81     Tuple[Optional[str], FileContent],
  82     # (filename, file (or text), content_type)
  83     Tuple[Optional[str], FileContent, Optional[str]],
  84 ]
  85 RequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]]
  86
  ```
  --- 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/httpx/_types.py b/httpx/_types.py
  --- a/httpx/_types.py
  +++ b/httpx/_types.py
  @@ -51,7 +51,14 @@
   
   CookieTypes = Union["Cookies", CookieJar, Dict[str, str], List[Tuple[str, str]]]
   
  -CertTypes = Union[str, Tuple[str, str], Tuple[str, str, str]]
  +CertTypes = Union[
  +    # certfile
  +    str,
  +    # (certfile, keyfile)
  +    Tuple[str, Optional[str]],
  +    # (certfile, keyfile, password)
  +    Tuple[str, Optional[str], Optional[str]],
  +]
   VerifyTypes = Union[str, bool, ssl.SSLContext]
   TimeoutTypes = Union[
       Optional[float],
  
verification_info: {"golden_diff": "diff --git a/httpx/_types.py b/httpx/_types.py\n--- a/httpx/_types.py\n+++ b/httpx/_types.py\n@@ -51,7 +51,14 @@\n \n CookieTypes = Union[\"Cookies\", CookieJar, Dict[str, str], List[Tuple[str, str]]]\n \n-CertTypes = Union[str, Tuple[str, str], Tuple[str, str, str]]\n+CertTypes = Union[\n+    # certfile\n+    str,\n+    # (certfile, keyfile)\n+    Tuple[str, Optional[str]],\n+    # (certfile, keyfile, password)\n+    Tuple[str, Optional[str], Optional[str]],\n+]\n VerifyTypes = Union[str, bool, ssl.SSLContext]\n TimeoutTypes = Union[\n     Optional[float],\n", "issue": "CertTypes `keyfile` and `password` should be Optional types.\n`SSLContext.load_cert_chain` can take `None` as arguments values ([docs](https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_cert_chain)) so I guess this:\r\nhttps://github.com/encode/httpx/blob/c09e61d50c8f169187cada6dbf14b89c7763c63f/httpx/_types.py#L54\r\nshould be rewritten as follows:\r\n```python\r\nCertTypes = Union[str, Tuple[str, Optional[str]], Tuple[str, Optional[str], Optional[str]]] \r\n```\n", "before_files": [{"content": "\"\"\"\nType definitions for type checking purposes.\n\"\"\"\n\nimport ssl\nfrom http.cookiejar import CookieJar\nfrom typing import (\n    IO,\n    TYPE_CHECKING,\n    AsyncIterable,\n    Callable,\n    Dict,\n    Iterable,\n    List,\n    Mapping,\n    Optional,\n    Sequence,\n    Tuple,\n    Union,\n)\n\nif TYPE_CHECKING:  # pragma: no cover\n    from ._auth import Auth  # noqa: F401\n    from ._config import Proxy, Timeout  # noqa: F401\n    from ._models import URL, Cookies, Headers, QueryParams, Request  # noqa: F401\n\n\nPrimitiveData = Optional[Union[str, int, float, bool]]\n\nRawURL = Tuple[bytes, bytes, Optional[int], bytes]\n\nURLTypes = Union[\"URL\", str]\n\nQueryParamTypes = Union[\n    \"QueryParams\",\n    Mapping[str, Union[PrimitiveData, Sequence[PrimitiveData]]],\n    List[Tuple[str, PrimitiveData]],\n    Tuple[Tuple[str, PrimitiveData], ...],\n    str,\n    bytes,\n    None,\n]\n\nHeaderTypes = Union[\n    \"Headers\",\n    Dict[str, str],\n    Dict[bytes, bytes],\n    Sequence[Tuple[str, str]],\n    Sequence[Tuple[bytes, bytes]],\n]\n\nCookieTypes = Union[\"Cookies\", CookieJar, Dict[str, str], List[Tuple[str, str]]]\n\nCertTypes = Union[str, Tuple[str, str], Tuple[str, str, str]]\nVerifyTypes = Union[str, bool, ssl.SSLContext]\nTimeoutTypes = Union[\n    Optional[float],\n    Tuple[Optional[float], Optional[float], Optional[float], Optional[float]],\n    \"Timeout\",\n]\nProxiesTypes = Union[URLTypes, \"Proxy\", Dict[URLTypes, Union[None, URLTypes, \"Proxy\"]]]\n\nAuthTypes = Union[\n    Tuple[Union[str, bytes], Union[str, bytes]],\n    Callable[[\"Request\"], \"Request\"],\n    \"Auth\",\n    None,\n]\n\nByteStream = Union[Iterable[bytes], AsyncIterable[bytes]]\nRequestContent = Union[str, bytes, ByteStream]\nResponseContent = Union[str, bytes, ByteStream]\n\nRequestData = dict\n\nFileContent = Union[IO[str], IO[bytes], str, bytes]\nFileTypes = Union[\n    # file (or text)\n    FileContent,\n    # (filename, file (or text))\n    Tuple[Optional[str], FileContent],\n    # (filename, file (or text), content_type)\n    Tuple[Optional[str], FileContent, Optional[str]],\n]\nRequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]]\n", "path": "httpx/_types.py"}], "after_files": [{"content": "\"\"\"\nType definitions for type checking purposes.\n\"\"\"\n\nimport ssl\nfrom http.cookiejar import CookieJar\nfrom typing import (\n    IO,\n    TYPE_CHECKING,\n    AsyncIterable,\n    Callable,\n    Dict,\n    Iterable,\n    List,\n    Mapping,\n    Optional,\n    Sequence,\n    Tuple,\n    Union,\n)\n\nif TYPE_CHECKING:  # pragma: no cover\n    from ._auth import Auth  # noqa: F401\n    from ._config import Proxy, Timeout  # noqa: F401\n    from ._models import URL, Cookies, Headers, QueryParams, Request  # noqa: F401\n\n\nPrimitiveData = Optional[Union[str, int, float, bool]]\n\nRawURL = Tuple[bytes, bytes, Optional[int], bytes]\n\nURLTypes = Union[\"URL\", str]\n\nQueryParamTypes = Union[\n    \"QueryParams\",\n    Mapping[str, Union[PrimitiveData, Sequence[PrimitiveData]]],\n    List[Tuple[str, PrimitiveData]],\n    Tuple[Tuple[str, PrimitiveData], ...],\n    str,\n    bytes,\n    None,\n]\n\nHeaderTypes = Union[\n    \"Headers\",\n    Dict[str, str],\n    Dict[bytes, bytes],\n    Sequence[Tuple[str, str]],\n    Sequence[Tuple[bytes, bytes]],\n]\n\nCookieTypes = Union[\"Cookies\", CookieJar, Dict[str, str], List[Tuple[str, str]]]\n\nCertTypes = Union[\n    # certfile\n    str,\n    # (certfile, keyfile)\n    Tuple[str, Optional[str]],\n    # (certfile, keyfile, password)\n    Tuple[str, Optional[str], Optional[str]],\n]\nVerifyTypes = Union[str, bool, ssl.SSLContext]\nTimeoutTypes = Union[\n    Optional[float],\n    Tuple[Optional[float], Optional[float], Optional[float], Optional[float]],\n    \"Timeout\",\n]\nProxiesTypes = Union[URLTypes, \"Proxy\", Dict[URLTypes, Union[None, URLTypes, \"Proxy\"]]]\n\nAuthTypes = Union[\n    Tuple[Union[str, bytes], Union[str, bytes]],\n    Callable[[\"Request\"], \"Request\"],\n    \"Auth\",\n    None,\n]\n\nByteStream = Union[Iterable[bytes], AsyncIterable[bytes]]\nRequestContent = Union[str, bytes, ByteStream]\nResponseContent = Union[str, bytes, ByteStream]\n\nRequestData = dict\n\nFileContent = Union[IO[str], IO[bytes], str, bytes]\nFileTypes = Union[\n    # file (or text)\n    FileContent,\n    # (filename, file (or text))\n    Tuple[Optional[str], FileContent],\n    # (filename, file (or text), content_type)\n    Tuple[Optional[str], FileContent, Optional[str]],\n]\nRequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]]\n", "path": "httpx/_types.py"}]}