We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
documentation build failure with sphinx-4.2.0
**Describe the bug**

On Debian unstable, patroni fails to build with the latest sphinx:

```
Running Sphinx v4.2.0
making output directory... done

Exception occurred:
  File "/<<PKGBUILDDIR>>/docs/conf.py", line 207, in setup
    app.add_stylesheet("custom.css")
AttributeError: 'Sphinx' object has no attribute 'add_stylesheet'
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/conf.py`
Content:
```
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 #
4 # Patroni documentation build configuration file, created by
5 # sphinx-quickstart on Mon Dec 19 16:54:09 2016.
6 #
7 # This file is execfile()d with the current directory set to its
8 # containing dir.
9 #
10 # Note that not all possible configuration values are present in this
11 # autogenerated file.
12 #
13 # All configuration values have a default; values that are commented out
14 # serve to show the default.
15 
16 # If extensions (or modules to document with autodoc) are in another directory,
17 # add these directories to sys.path here. If the directory is relative to the
18 # documentation root, use os.path.abspath to make it absolute, like shown here.
19 #
20 import os
21 
22 import sys
23 sys.path.insert(0, os.path.abspath('..'))
24 
25 from patroni.version import __version__
26 
27 # -- General configuration ------------------------------------------------
28 
29 # If your documentation needs a minimal Sphinx version, state it here.
30 #
31 # needs_sphinx = '1.0'
32 
33 # Add any Sphinx extension module names here, as strings. They can be
34 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35 # ones.
36 extensions = ['sphinx.ext.intersphinx',
37     'sphinx.ext.todo',
38     'sphinx.ext.mathjax',
39     'sphinx.ext.ifconfig',
40     'sphinx.ext.viewcode']
41 
42 # Add any paths that contain templates here, relative to this directory.
43 templates_path = ['_templates']
44 
45 # The suffix(es) of source filenames.
46 # You can specify multiple suffix as a list of string:
47 #
48 # source_suffix = ['.rst', '.md']
49 source_suffix = '.rst'
50 
51 # The master toctree document.
52 master_doc = 'index'
53 
54 # General information about the project.
55 project = 'Patroni'
56 copyright = '2015 Compose, Zalando SE'
57 author = 'Zalando SE'
58 
59 # The version info for the project you're documenting, acts as replacement for
60 # |version| and |release|, also used in various other places throughout the
61 # built documents.
62 #
63 # The short X.Y version.
64 version = __version__[:__version__.rfind('.')]
65 # The full version, including alpha/beta/rc tags.
66 release = __version__
67 
68 # The language for content autogenerated by Sphinx. Refer to documentation
69 # for a list of supported languages.
70 #
71 # This is also used if you do content translation via gettext catalogs.
72 # Usually you set "language" from the command line for these cases.
73 language = None
74 
75 # List of patterns, relative to source directory, that match files and
76 # directories to ignore when looking for source files.
77 # This patterns also effect to html_static_path and html_extra_path
78 exclude_patterns = []
79 
80 # The name of the Pygments (syntax highlighting) style to use.
81 pygments_style = 'sphinx'
82 
83 # If true, `todo` and `todoList` produce output, else they produce nothing.
84 todo_include_todos = True
85 
86 
87 # -- Options for HTML output ----------------------------------------------
88 
89 # The theme to use for HTML and HTML Help pages.  See the documentation for
90 # a list of builtin themes.
91 #
92 
93 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
94 if not on_rtd:  # only import and set the theme if we're building docs locally
95     import sphinx_rtd_theme
96     html_theme = 'sphinx_rtd_theme'
97     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
98 
99 # Theme options are theme-specific and customize the look and feel of a theme
100 # further.  For a list of options available for each theme, see the
101 # documentation.
102 #
103 # html_theme_options = {}
104 
105 # Add any paths that contain custom static files (such as style sheets) here,
106 # relative to this directory. They are copied after the builtin static files,
107 # so a file named "default.css" will overwrite the builtin "default.css".
108 html_static_path = ['_static']
109 
110 
111 # -- Options for HTMLHelp output ------------------------------------------
112 
113 # Output file base name for HTML help builder.
114 htmlhelp_basename = 'Patronidoc'
115 
116 
117 # -- Options for LaTeX output ---------------------------------------------
118 
119 latex_elements = {
120     # The paper size ('letterpaper' or 'a4paper').
121     #
122     # 'papersize': 'letterpaper',
123 
124     # The font size ('10pt', '11pt' or '12pt').
125     #
126     # 'pointsize': '10pt',
127 
128     # Additional stuff for the LaTeX preamble.
129     #
130     # 'preamble': '',
131 
132     # Latex figure (float) alignment
133     #
134     # 'figure_align': 'htbp',
135 }
136 
137 # Grouping the document tree into LaTeX files. List of tuples
138 # (source start file, target name, title,
139 #  author, documentclass [howto, manual, or own class]).
140 latex_documents = [
141     (master_doc, 'Patroni.tex', 'Patroni Documentation',
142      'Zalando SE', 'manual'),
143 ]
144 
145 
146 # -- Options for manual page output ---------------------------------------
147 
148 # One entry per manual page. List of tuples
149 # (source start file, name, description, authors, manual section).
150 man_pages = [
151     (master_doc, 'patroni', 'Patroni Documentation',
152      [author], 1)
153 ]
154 
155 
156 # -- Options for Texinfo output -------------------------------------------
157 
158 # Grouping the document tree into Texinfo files. List of tuples
159 # (source start file, target name, title, author,
160 #  dir menu entry, description, category)
161 texinfo_documents = [
162     (master_doc, 'Patroni', 'Patroni Documentation',
163      author, 'Patroni', 'One line description of project.',
164      'Miscellaneous'),
165 ]
166 
167 
168 
169 # -- Options for Epub output ----------------------------------------------
170 
171 # Bibliographic Dublin Core info.
172 epub_title = project
173 epub_author = author
174 epub_publisher = author
175 epub_copyright = copyright
176 
177 # The unique identifier of the text. This can be a ISBN number
178 # or the project homepage.
179 #
180 # epub_identifier = ''
181 
182 # A unique identification for the text.
183 #
184 # epub_uid = ''
185 
186 # A list of files that should not be packed into the epub file.
187 epub_exclude_files = ['search.html']
188 
189 
190 
191 # Example configuration for intersphinx: refer to the Python standard library.
192 intersphinx_mapping = {'https://docs.python.org/': None}
193 
194 # A possibility to have an own stylesheet, to add new rules or override existing ones
195 # For the latter case, the CSS specificity of the rules should be higher than the default ones
196 def setup(app):
197    app.add_stylesheet("custom.css")
198
```
--- 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()

```

diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -194,4 +194,7 @@
 # A possibility to have an own stylesheet, to add new rules or override existing ones
 # For the latter case, the CSS specificity of the rules should be higher than the default ones
 def setup(app):
-   app.add_stylesheet("custom.css")
+    if hasattr(app, 'add_css_file'):
+        app.add_css_file('custom.css')
+    else:
+        app.add_stylesheet('custom.css')

{"golden_diff": "diff --git a/docs/conf.py b/docs/conf.py\n--- a/docs/conf.py\n+++ b/docs/conf.py\n@@ -194,4 +194,7 @@\n # A possibility to have an own stylesheet, to add new rules or override existing ones\n # For the latter case, the CSS specificity of the rules should be higher than the default ones\n def setup(app):\n-   app.add_stylesheet(\"custom.css\")\n+    if hasattr(app, 'add_css_file'):\n+        app.add_css_file('custom.css')\n+    else:\n+        app.add_stylesheet('custom.css')\n", "issue": "documentation build failure with sphinx-4.2.0\n**Describe the bug**\r\n\r\nOn Debian unstable, patroni fails to build with the latest sphinx:\r\n\r\n```\r\nRunning Sphinx v4.2.0\r\nmaking output directory... done\r\n\r\nException occurred:\r\n  File \"/<<PKGBUILDDIR>>/docs/conf.py\", line 207, in setup\r\n    app.add_stylesheet(\"custom.css\")\r\nAttributeError: 'Sphinx' object has no attribute 'add_stylesheet'\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Patroni documentation build configuration file, created by\n# sphinx-quickstart on Mon Dec 19 16:54:09 2016.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\n\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\n\nfrom patroni.version import __version__\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = ['sphinx.ext.intersphinx',\n    'sphinx.ext.todo',\n    'sphinx.ext.mathjax',\n    'sphinx.ext.ifconfig',\n    'sphinx.ext.viewcode']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = 'Patroni'\ncopyright = '2015 Compose, Zalando SE'\nauthor = 'Zalando SE'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = __version__[:__version__.rfind('.')]\n# The full version, including alpha/beta/rc tags.\nrelease = __version__\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This patterns also effect to html_static_path and html_extra_path\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\n\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\nif not on_rtd:  # only import and set the theme if we're building docs locally\n    import sphinx_rtd_theme\n    html_theme = 'sphinx_rtd_theme'\n    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n#\n# html_theme_options = {}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n\n# -- Options for HTMLHelp output ------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'Patronidoc'\n\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, 'Patroni.tex', 'Patroni Documentation',\n     'Zalando SE', 'manual'),\n]\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n    (master_doc, 'patroni', 'Patroni Documentation',\n     [author], 1)\n]\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (master_doc, 'Patroni', 'Patroni Documentation',\n     author, 'Patroni', 'One line description of project.',\n     'Miscellaneous'),\n]\n\n\n\n# -- Options for Epub output ----------------------------------------------\n\n# Bibliographic Dublin Core info.\nepub_title = project\nepub_author = author\nepub_publisher = author\nepub_copyright = copyright\n\n# The unique identifier of the text. This can be a ISBN number\n# or the project homepage.\n#\n# epub_identifier = ''\n\n# A unique identification for the text.\n#\n# epub_uid = ''\n\n# A list of files that should not be packed into the epub file.\nepub_exclude_files = ['search.html']\n\n\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {'https://docs.python.org/': None}\n\n# A possibility to have an own stylesheet, to add new rules or override existing ones\n# For the latter case, the CSS specificity of the rules should be higher than the default ones\ndef setup(app):\n   app.add_stylesheet(\"custom.css\")\n", "path": "docs/conf.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Patroni documentation build configuration file, created by\n# sphinx-quickstart on Mon Dec 19 16:54:09 2016.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\n\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\n\nfrom patroni.version import __version__\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = ['sphinx.ext.intersphinx',\n    'sphinx.ext.todo',\n    'sphinx.ext.mathjax',\n    'sphinx.ext.ifconfig',\n    'sphinx.ext.viewcode']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = 'Patroni'\ncopyright = '2015 Compose, Zalando SE'\nauthor = 'Zalando SE'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = __version__[:__version__.rfind('.')]\n# The full version, including alpha/beta/rc tags.\nrelease = __version__\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This patterns also effect to html_static_path and html_extra_path\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\n\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\nif not on_rtd:  # only import and set the theme if we're building docs locally\n    import sphinx_rtd_theme\n    html_theme = 'sphinx_rtd_theme'\n    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n#\n# html_theme_options = {}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n\n# -- Options for HTMLHelp output ------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'Patronidoc'\n\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, 'Patroni.tex', 'Patroni Documentation',\n     'Zalando SE', 'manual'),\n]\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n    (master_doc, 'patroni', 'Patroni Documentation',\n     [author], 1)\n]\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (master_doc, 'Patroni', 'Patroni Documentation',\n     author, 'Patroni', 'One line description of project.',\n     'Miscellaneous'),\n]\n\n\n\n# -- Options for Epub output ----------------------------------------------\n\n# Bibliographic Dublin Core info.\nepub_title = project\nepub_author = author\nepub_publisher = author\nepub_copyright = copyright\n\n# The unique identifier of the text. This can be a ISBN number\n# or the project homepage.\n#\n# epub_identifier = ''\n\n# A unique identification for the text.\n#\n# epub_uid = ''\n\n# A list of files that should not be packed into the epub file.\nepub_exclude_files = ['search.html']\n\n\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {'https://docs.python.org/': None}\n\n# A possibility to have an own stylesheet, to add new rules or override existing ones\n# For the latter case, the CSS specificity of the rules should be higher than the default ones\ndef setup(app):\n    if hasattr(app, 'add_css_file'):\n        app.add_css_file('custom.css')\n    else:\n        app.add_stylesheet('custom.css')\n", "path": "docs/conf.py"}]}