We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Python 3.9 compatibility (resolve DeprecationWarning from collections)
### Issue Summary

Wagtail hits the warning `DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working` in various places.

- [x] Jinja2>2.10.1 
- [x] html5lib>1.0.1 (see https://github.com/html5lib/html5lib-python/issues/419)
- [x] beautifulsoup4>=4.8.0 (or maybe earlier)
- [x] fix wagtail/utils/l18n/translation.py:5 (#5485)

### Steps to Reproduce

1. run `tox -e py37-dj22-sqlite-noelasticsearch -- --deprecation all`
2. note deprecation warnings:


```
site-packages/jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
site-packages/jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
```
resolved by https://github.com/pallets/jinja/pull/867 - the fix is on master not released yet (as of Jinja2==2.10.1)

```
site-packages/html5lib/_trie/_base.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping
```

Fixed in https://github.com/html5lib/html5lib-python/issues/402 , but not released yet as of 1.0.1 (see https://github.com/html5lib/html5lib-python/issues/419 )

```
site-packages/bs4/element.py:1134: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  if not isinstance(formatter, collections.Callable):
```
https://bugs.launchpad.net/beautifulsoup/+bug/1778909 - resolved by beautifulsoup4>=4.8.0 (and earlier I think)

I'm also seeing one in Wagtail from my own project tests here, the above tox run didn't seem to hit it:

```
wagtail/utils/l18n/translation.py:5: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
```

See #5485 

* I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: 

yes (on master at bb4e2fe2dfe69fc3143f38c6e34dbe6f2f2f01e0 )

### Technical details

* Python version: Run `python --version`.

Python 3.7.3

* Django version: Look in your requirements.txt, or run `pip show django | grep Version`.

Django 2.2

* Wagtail version: Look at the bottom of the Settings menu in the Wagtail admin, or run `pip show wagtail | grep Version:`.

2.7.0.alpha.0


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 from wagtail import __version__
4 from wagtail.utils.setup import assets, check_bdist_egg, sdist
5 
6 
7 try:
8     from setuptools import find_packages, setup
9 except ImportError:
10     from distutils.core import setup
11 
12 
13 # Hack to prevent "TypeError: 'NoneType' object is not callable" error
14 # in multiprocessing/util.py _exit_function when setup.py exits
15 # (see http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
16 try:
17     import multiprocessing  # noqa
18 except ImportError:
19     pass
20 
21 
22 install_requires = [
23     "Django>=2.2,<3.2",
24     "django-modelcluster>=5.1,<6.0",
25     "django-taggit>=1.0,<2.0",
26     "django-treebeard>=4.2.0,<5.0",
27     "djangorestframework>=3.11.1,<4.0",
28     "django-filter>=2.2,<3.0",
29     "draftjs_exporter>=2.1.5,<3.0",
30     "Pillow>=4.0.0,<9.0.0",
31     "beautifulsoup4>=4.8,<4.9",
32     "html5lib>=0.999,<2",
33     "Willow>=1.4,<1.5",
34     "requests>=2.11.1,<3.0",
35     "l18n>=2018.5",
36     "xlsxwriter>=1.2.8,<2.0",
37     "tablib[xls,xlsx]>=0.14.0",
38     "anyascii>=0.1.5",
39 ]
40 
41 # Testing dependencies
42 testing_extras = [
43     # Required for running the tests
44     'python-dateutil>=2.2',
45     'pytz>=2014.7',
46     'elasticsearch>=1.0.0,<3.0',
47     'Jinja2>=2.8,<3.0',
48     'boto3>=1.4,<1.5',
49     'freezegun>=0.3.8',
50     'openpyxl>=2.6.4',
51     'Unidecode>=0.04.14,<2.0',
52 
53     # For coverage and PEP8 linting
54     'coverage>=3.7.0',
55     'flake8>=3.6.0',
56     'isort==5.6.4',  # leave this pinned - it tends to change rules between patch releases
57     'flake8-blind-except==0.1.1',
58     'flake8-print==2.0.2',
59     'doc8==0.8.1',
60 
61     # For templates linting
62     'jinjalint>=0.5',
63 
64     # Pipenv hack to fix broken dependency causing CircleCI failures
65     'docutils==0.15',
66 
67     # django-taggit 1.3.0 made changes to verbose_name which affect migrations;
68     # the test suite migrations correspond to >=1.3.0
69     'django-taggit>=1.3.0,<2.0',
70 ]
71 
72 # Documentation dependencies
73 documentation_extras = [
74     'pyenchant>=3.1.1,<4',
75     'sphinxcontrib-spelling>=5.4.0,<6',
76     'Sphinx>=1.5.2',
77     'sphinx-autobuild>=0.6.0',
78     'sphinx_rtd_theme>=0.1.9',
79 ]
80 
81 setup(
82     name='wagtail',
83     version=__version__,
84     description='A Django content management system.',
85     author='Wagtail core team + contributors',
86     author_email='hello@wagtail.io',  # For support queries, please see https://docs.wagtail.io/en/stable/support.html
87     url='https://wagtail.io/',
88     packages=find_packages(),
89     include_package_data=True,
90     license='BSD',
91     long_description="Wagtail is an open source content management \
92 system built on Django, with a strong community and commercial support. \
93 It’s focused on user experience, and offers precise control for \
94 designers and developers.\n\n\
95 For more details, see https://wagtail.io, https://docs.wagtail.io and \
96 https://github.com/wagtail/wagtail/.",
97     classifiers=[
98         'Development Status :: 5 - Production/Stable',
99         'Environment :: Web Environment',
100         'Intended Audience :: Developers',
101         'License :: OSI Approved :: BSD License',
102         'Operating System :: OS Independent',
103         'Programming Language :: Python',
104         'Programming Language :: Python :: 3',
105         'Programming Language :: Python :: 3.6',
106         'Programming Language :: Python :: 3.7',
107         'Programming Language :: Python :: 3.8',
108         'Framework :: Django',
109         'Framework :: Django :: 2.2',
110         'Framework :: Django :: 3.0',
111         'Framework :: Django :: 3.1',
112         'Framework :: Wagtail',
113         'Topic :: Internet :: WWW/HTTP :: Site Management',
114     ],
115     python_requires='>=3.6',
116     install_requires=install_requires,
117     extras_require={
118         'testing': testing_extras,
119         'docs': documentation_extras
120     },
121     entry_points="""
122             [console_scripts]
123             wagtail=wagtail.bin.wagtail:main
124     """,
125     zip_safe=False,
126     cmdclass={
127         'sdist': sdist,
128         'bdist_egg': check_bdist_egg,
129         'assets': assets,
130     },
131 )
132
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -45,7 +45,7 @@
     'pytz>=2014.7',
     'elasticsearch>=1.0.0,<3.0',
     'Jinja2>=2.8,<3.0',
-    'boto3>=1.4,<1.5',
+    'boto3>=1.16,<1.17',
     'freezegun>=0.3.8',
     'openpyxl>=2.6.4',
     'Unidecode>=0.04.14,<2.0',
@@ -105,6 +105,7 @@
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
         'Framework :: Django',
         'Framework :: Django :: 2.2',
         'Framework :: Django :: 3.0',

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -45,7 +45,7 @@\n     'pytz>=2014.7',\n     'elasticsearch>=1.0.0,<3.0',\n     'Jinja2>=2.8,<3.0',\n-    'boto3>=1.4,<1.5',\n+    'boto3>=1.16,<1.17',\n     'freezegun>=0.3.8',\n     'openpyxl>=2.6.4',\n     'Unidecode>=0.04.14,<2.0',\n@@ -105,6 +105,7 @@\n         'Programming Language :: Python :: 3.6',\n         'Programming Language :: Python :: 3.7',\n         'Programming Language :: Python :: 3.8',\n+        'Programming Language :: Python :: 3.9',\n         'Framework :: Django',\n         'Framework :: Django :: 2.2',\n         'Framework :: Django :: 3.0',\n", "issue": "Python 3.9 compatibility (resolve DeprecationWarning from collections)\n### Issue Summary\r\n\r\nWagtail hits the warning `DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working` in various places.\r\n\r\n- [x] Jinja2>2.10.1 \r\n- [x] html5lib>1.0.1 (see https://github.com/html5lib/html5lib-python/issues/419)\r\n- [x] beautifulsoup4>=4.8.0 (or maybe earlier)\r\n- [x] fix wagtail/utils/l18n/translation.py:5 (#5485)\r\n\r\n### Steps to Reproduce\r\n\r\n1. run `tox -e py37-dj22-sqlite-noelasticsearch -- --deprecation all`\r\n2. note deprecation warnings:\r\n\r\n\r\n```\r\nsite-packages/jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\r\nsite-packages/jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\r\n```\r\nresolved by https://github.com/pallets/jinja/pull/867 - the fix is on master not released yet (as of Jinja2==2.10.1)\r\n\r\n```\r\nsite-packages/html5lib/_trie/_base.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\r\n  from collections import Mapping\r\n```\r\n\r\nFixed in https://github.com/html5lib/html5lib-python/issues/402 , but not released yet as of 1.0.1 (see https://github.com/html5lib/html5lib-python/issues/419 )\r\n\r\n```\r\nsite-packages/bs4/element.py:1134: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\r\n  if not isinstance(formatter, collections.Callable):\r\n```\r\nhttps://bugs.launchpad.net/beautifulsoup/+bug/1778909 - resolved by beautifulsoup4>=4.8.0 (and earlier I think)\r\n\r\nI'm also seeing one in Wagtail from my own project tests here, the above tox run didn't seem to hit it:\r\n\r\n```\r\nwagtail/utils/l18n/translation.py:5: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\r\n```\r\n\r\nSee #5485 \r\n\r\n* I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: \r\n\r\nyes (on master at bb4e2fe2dfe69fc3143f38c6e34dbe6f2f2f01e0 )\r\n\r\n### Technical details\r\n\r\n* Python version: Run `python --version`.\r\n\r\nPython 3.7.3\r\n\r\n* Django version: Look in your requirements.txt, or run `pip show django | grep Version`.\r\n\r\nDjango 2.2\r\n\r\n* Wagtail version: Look at the bottom of the Settings menu in the Wagtail admin, or run `pip show wagtail | grep Version:`.\r\n\r\n2.7.0.alpha.0\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n\nfrom wagtail import __version__\nfrom wagtail.utils.setup import assets, check_bdist_egg, sdist\n\n\ntry:\n    from setuptools import find_packages, setup\nexcept ImportError:\n    from distutils.core import setup\n\n\n# Hack to prevent \"TypeError: 'NoneType' object is not callable\" error\n# in multiprocessing/util.py _exit_function when setup.py exits\n# (see http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)\ntry:\n    import multiprocessing  # noqa\nexcept ImportError:\n    pass\n\n\ninstall_requires = [\n    \"Django>=2.2,<3.2\",\n    \"django-modelcluster>=5.1,<6.0\",\n    \"django-taggit>=1.0,<2.0\",\n    \"django-treebeard>=4.2.0,<5.0\",\n    \"djangorestframework>=3.11.1,<4.0\",\n    \"django-filter>=2.2,<3.0\",\n    \"draftjs_exporter>=2.1.5,<3.0\",\n    \"Pillow>=4.0.0,<9.0.0\",\n    \"beautifulsoup4>=4.8,<4.9\",\n    \"html5lib>=0.999,<2\",\n    \"Willow>=1.4,<1.5\",\n    \"requests>=2.11.1,<3.0\",\n    \"l18n>=2018.5\",\n    \"xlsxwriter>=1.2.8,<2.0\",\n    \"tablib[xls,xlsx]>=0.14.0\",\n    \"anyascii>=0.1.5\",\n]\n\n# Testing dependencies\ntesting_extras = [\n    # Required for running the tests\n    'python-dateutil>=2.2',\n    'pytz>=2014.7',\n    'elasticsearch>=1.0.0,<3.0',\n    'Jinja2>=2.8,<3.0',\n    'boto3>=1.4,<1.5',\n    'freezegun>=0.3.8',\n    'openpyxl>=2.6.4',\n    'Unidecode>=0.04.14,<2.0',\n\n    # For coverage and PEP8 linting\n    'coverage>=3.7.0',\n    'flake8>=3.6.0',\n    'isort==5.6.4',  # leave this pinned - it tends to change rules between patch releases\n    'flake8-blind-except==0.1.1',\n    'flake8-print==2.0.2',\n    'doc8==0.8.1',\n\n    # For templates linting\n    'jinjalint>=0.5',\n\n    # Pipenv hack to fix broken dependency causing CircleCI failures\n    'docutils==0.15',\n\n    # django-taggit 1.3.0 made changes to verbose_name which affect migrations;\n    # the test suite migrations correspond to >=1.3.0\n    'django-taggit>=1.3.0,<2.0',\n]\n\n# Documentation dependencies\ndocumentation_extras = [\n    'pyenchant>=3.1.1,<4',\n    'sphinxcontrib-spelling>=5.4.0,<6',\n    'Sphinx>=1.5.2',\n    'sphinx-autobuild>=0.6.0',\n    'sphinx_rtd_theme>=0.1.9',\n]\n\nsetup(\n    name='wagtail',\n    version=__version__,\n    description='A Django content management system.',\n    author='Wagtail core team + contributors',\n    author_email='hello@wagtail.io',  # For support queries, please see https://docs.wagtail.io/en/stable/support.html\n    url='https://wagtail.io/',\n    packages=find_packages(),\n    include_package_data=True,\n    license='BSD',\n    long_description=\"Wagtail is an open source content management \\\nsystem built on Django, with a strong community and commercial support. \\\nIt\u2019s focused on user experience, and offers precise control for \\\ndesigners and developers.\\n\\n\\\nFor more details, see https://wagtail.io, https://docs.wagtail.io and \\\nhttps://github.com/wagtail/wagtail/.\",\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Web Environment',\n        'Intended Audience :: Developers',\n        'License :: OSI Approved :: BSD License',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n        'Framework :: Django',\n        'Framework :: Django :: 2.2',\n        'Framework :: Django :: 3.0',\n        'Framework :: Django :: 3.1',\n        'Framework :: Wagtail',\n        'Topic :: Internet :: WWW/HTTP :: Site Management',\n    ],\n    python_requires='>=3.6',\n    install_requires=install_requires,\n    extras_require={\n        'testing': testing_extras,\n        'docs': documentation_extras\n    },\n    entry_points=\"\"\"\n            [console_scripts]\n            wagtail=wagtail.bin.wagtail:main\n    \"\"\",\n    zip_safe=False,\n    cmdclass={\n        'sdist': sdist,\n        'bdist_egg': check_bdist_egg,\n        'assets': assets,\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nfrom wagtail import __version__\nfrom wagtail.utils.setup import assets, check_bdist_egg, sdist\n\n\ntry:\n    from setuptools import find_packages, setup\nexcept ImportError:\n    from distutils.core import setup\n\n\n# Hack to prevent \"TypeError: 'NoneType' object is not callable\" error\n# in multiprocessing/util.py _exit_function when setup.py exits\n# (see http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)\ntry:\n    import multiprocessing  # noqa\nexcept ImportError:\n    pass\n\n\ninstall_requires = [\n    \"Django>=2.2,<3.2\",\n    \"django-modelcluster>=5.1,<6.0\",\n    \"django-taggit>=1.0,<2.0\",\n    \"django-treebeard>=4.2.0,<5.0\",\n    \"djangorestframework>=3.11.1,<4.0\",\n    \"django-filter>=2.2,<3.0\",\n    \"draftjs_exporter>=2.1.5,<3.0\",\n    \"Pillow>=4.0.0,<9.0.0\",\n    \"beautifulsoup4>=4.8,<4.9\",\n    \"html5lib>=0.999,<2\",\n    \"Willow>=1.4,<1.5\",\n    \"requests>=2.11.1,<3.0\",\n    \"l18n>=2018.5\",\n    \"xlsxwriter>=1.2.8,<2.0\",\n    \"tablib[xls,xlsx]>=0.14.0\",\n    \"anyascii>=0.1.5\",\n]\n\n# Testing dependencies\ntesting_extras = [\n    # Required for running the tests\n    'python-dateutil>=2.2',\n    'pytz>=2014.7',\n    'elasticsearch>=1.0.0,<3.0',\n    'Jinja2>=2.8,<3.0',\n    'boto3>=1.16,<1.17',\n    'freezegun>=0.3.8',\n    'openpyxl>=2.6.4',\n    'Unidecode>=0.04.14,<2.0',\n\n    # For coverage and PEP8 linting\n    'coverage>=3.7.0',\n    'flake8>=3.6.0',\n    'isort==5.6.4',  # leave this pinned - it tends to change rules between patch releases\n    'flake8-blind-except==0.1.1',\n    'flake8-print==2.0.2',\n    'doc8==0.8.1',\n\n    # For templates linting\n    'jinjalint>=0.5',\n\n    # Pipenv hack to fix broken dependency causing CircleCI failures\n    'docutils==0.15',\n\n    # django-taggit 1.3.0 made changes to verbose_name which affect migrations;\n    # the test suite migrations correspond to >=1.3.0\n    'django-taggit>=1.3.0,<2.0',\n]\n\n# Documentation dependencies\ndocumentation_extras = [\n    'pyenchant>=3.1.1,<4',\n    'sphinxcontrib-spelling>=5.4.0,<6',\n    'Sphinx>=1.5.2',\n    'sphinx-autobuild>=0.6.0',\n    'sphinx_rtd_theme>=0.1.9',\n]\n\nsetup(\n    name='wagtail',\n    version=__version__,\n    description='A Django content management system.',\n    author='Wagtail core team + contributors',\n    author_email='hello@wagtail.io',  # For support queries, please see https://docs.wagtail.io/en/stable/support.html\n    url='https://wagtail.io/',\n    packages=find_packages(),\n    include_package_data=True,\n    license='BSD',\n    long_description=\"Wagtail is an open source content management \\\nsystem built on Django, with a strong community and commercial support. \\\nIt\u2019s focused on user experience, and offers precise control for \\\ndesigners and developers.\\n\\n\\\nFor more details, see https://wagtail.io, https://docs.wagtail.io and \\\nhttps://github.com/wagtail/wagtail/.\",\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Web Environment',\n        'Intended Audience :: Developers',\n        'License :: OSI Approved :: BSD License',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n        'Programming Language :: Python :: 3.9',\n        'Framework :: Django',\n        'Framework :: Django :: 2.2',\n        'Framework :: Django :: 3.0',\n        'Framework :: Django :: 3.1',\n        'Framework :: Wagtail',\n        'Topic :: Internet :: WWW/HTTP :: Site Management',\n    ],\n    python_requires='>=3.6',\n    install_requires=install_requires,\n    extras_require={\n        'testing': testing_extras,\n        'docs': documentation_extras\n    },\n    entry_points=\"\"\"\n            [console_scripts]\n            wagtail=wagtail.bin.wagtail:main\n    \"\"\",\n    zip_safe=False,\n    cmdclass={\n        'sdist': sdist,\n        'bdist_egg': check_bdist_egg,\n        'assets': assets,\n    },\n)\n", "path": "setup.py"}]}