We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Increment threadsafety on BigQuery DB-API interface when httplib2 is removed
From https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2921/files/5b29a9e42a40f7c74ced0b7a7e9db0add52a20a1#r123596828

Blocked by https://github.com/GoogleCloudPlatform/google-cloud-python/issues/1998

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bigquery/google/cloud/bigquery/dbapi/__init__.py`
Content:
```
1 # Copyright 2017 Google Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14 
15 """Google BigQuery implementation of the Database API Specification v2.0.
16 
17 This module implements the `Python Database API Specification v2.0 (DB-API)`_
18 for Google BigQuery.
19 
20 .. _Python Database API Specification v2.0 (DB-API):
21    https://www.python.org/dev/peps/pep-0249/
22 
23 .. warning::
24    The ``dbapi`` module is **alpha**. The implementation is not complete. It
25    might be changed in backward-incompatible ways and is not subject to any SLA
26    or deprecation policy.
27 """
28 
29 from google.cloud.bigquery.dbapi.connection import connect
30 from google.cloud.bigquery.dbapi.connection import Connection
31 from google.cloud.bigquery.dbapi.cursor import Cursor
32 from google.cloud.bigquery.dbapi.exceptions import Warning
33 from google.cloud.bigquery.dbapi.exceptions import Error
34 from google.cloud.bigquery.dbapi.exceptions import InterfaceError
35 from google.cloud.bigquery.dbapi.exceptions import DatabaseError
36 from google.cloud.bigquery.dbapi.exceptions import DataError
37 from google.cloud.bigquery.dbapi.exceptions import OperationalError
38 from google.cloud.bigquery.dbapi.exceptions import IntegrityError
39 from google.cloud.bigquery.dbapi.exceptions import InternalError
40 from google.cloud.bigquery.dbapi.exceptions import ProgrammingError
41 from google.cloud.bigquery.dbapi.exceptions import NotSupportedError
42 from google.cloud.bigquery.dbapi.types import Binary
43 from google.cloud.bigquery.dbapi.types import Date
44 from google.cloud.bigquery.dbapi.types import DateFromTicks
45 from google.cloud.bigquery.dbapi.types import Time
46 from google.cloud.bigquery.dbapi.types import TimeFromTicks
47 from google.cloud.bigquery.dbapi.types import Timestamp
48 from google.cloud.bigquery.dbapi.types import TimestampFromTicks
49 from google.cloud.bigquery.dbapi.types import BINARY
50 from google.cloud.bigquery.dbapi.types import DATETIME
51 from google.cloud.bigquery.dbapi.types import NUMBER
52 from google.cloud.bigquery.dbapi.types import ROWID
53 from google.cloud.bigquery.dbapi.types import STRING
54 
55 
56 apilevel = '2.0'
57 
58 # Threads may share the module, but not connections.
59 threadsafety = 1
60 
61 paramstyle = 'pyformat'
62 
63 __all__ = [
64     'apilevel', 'threadsafety', 'paramstyle', 'connect', 'Connection',
65     'Cursor', 'Warning', 'Error', 'InterfaceError', 'DatabaseError',
66     'DataError', 'OperationalError', 'IntegrityError', 'InternalError',
67     'ProgrammingError', 'NotSupportedError', 'Binary', 'Date', 'DateFromTicks',
68     'Time', 'TimeFromTicks', 'Timestamp', 'TimestampFromTicks', 'BINARY',
69     'DATETIME', 'NUMBER', 'ROWID', 'STRING',
70 ]
71
```
--- 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/bigquery/google/cloud/bigquery/dbapi/__init__.py b/bigquery/google/cloud/bigquery/dbapi/__init__.py
--- a/bigquery/google/cloud/bigquery/dbapi/__init__.py
+++ b/bigquery/google/cloud/bigquery/dbapi/__init__.py
@@ -55,8 +55,8 @@
 
 apilevel = '2.0'
 
-# Threads may share the module, but not connections.
-threadsafety = 1
+# Threads may share the module and connections, but not cursors.
+threadsafety = 2
 
 paramstyle = 'pyformat'

{"golden_diff": "diff --git a/bigquery/google/cloud/bigquery/dbapi/__init__.py b/bigquery/google/cloud/bigquery/dbapi/__init__.py\n--- a/bigquery/google/cloud/bigquery/dbapi/__init__.py\n+++ b/bigquery/google/cloud/bigquery/dbapi/__init__.py\n@@ -55,8 +55,8 @@\n \n apilevel = '2.0'\n \n-# Threads may share the module, but not connections.\n-threadsafety = 1\n+# Threads may share the module and connections, but not cursors.\n+threadsafety = 2\n \n paramstyle = 'pyformat'\n", "issue": "Increment threadsafety on BigQuery DB-API interface when httplib2 is removed\nFrom https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2921/files/5b29a9e42a40f7c74ced0b7a7e9db0add52a20a1#r123596828\r\n\r\nBlocked by https://github.com/GoogleCloudPlatform/google-cloud-python/issues/1998\n", "before_files": [{"content": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n#  Unless required by applicable law or agreed to in writing, software\n#  distributed under the License is distributed on an \"AS IS\" BASIS,\n#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#  See the License for the specific language governing permissions and\n#  limitations under the License.\n\n\"\"\"Google BigQuery implementation of the Database API Specification v2.0.\n\nThis module implements the `Python Database API Specification v2.0 (DB-API)`_\nfor Google BigQuery.\n\n.. _Python Database API Specification v2.0 (DB-API):\n   https://www.python.org/dev/peps/pep-0249/\n\n.. warning::\n   The ``dbapi`` module is **alpha**. The implementation is not complete. It\n   might be changed in backward-incompatible ways and is not subject to any SLA\n   or deprecation policy.\n\"\"\"\n\nfrom google.cloud.bigquery.dbapi.connection import connect\nfrom google.cloud.bigquery.dbapi.connection import Connection\nfrom google.cloud.bigquery.dbapi.cursor import Cursor\nfrom google.cloud.bigquery.dbapi.exceptions import Warning\nfrom google.cloud.bigquery.dbapi.exceptions import Error\nfrom google.cloud.bigquery.dbapi.exceptions import InterfaceError\nfrom google.cloud.bigquery.dbapi.exceptions import DatabaseError\nfrom google.cloud.bigquery.dbapi.exceptions import DataError\nfrom google.cloud.bigquery.dbapi.exceptions import OperationalError\nfrom google.cloud.bigquery.dbapi.exceptions import IntegrityError\nfrom google.cloud.bigquery.dbapi.exceptions import InternalError\nfrom google.cloud.bigquery.dbapi.exceptions import ProgrammingError\nfrom google.cloud.bigquery.dbapi.exceptions import NotSupportedError\nfrom google.cloud.bigquery.dbapi.types import Binary\nfrom google.cloud.bigquery.dbapi.types import Date\nfrom google.cloud.bigquery.dbapi.types import DateFromTicks\nfrom google.cloud.bigquery.dbapi.types import Time\nfrom google.cloud.bigquery.dbapi.types import TimeFromTicks\nfrom google.cloud.bigquery.dbapi.types import Timestamp\nfrom google.cloud.bigquery.dbapi.types import TimestampFromTicks\nfrom google.cloud.bigquery.dbapi.types import BINARY\nfrom google.cloud.bigquery.dbapi.types import DATETIME\nfrom google.cloud.bigquery.dbapi.types import NUMBER\nfrom google.cloud.bigquery.dbapi.types import ROWID\nfrom google.cloud.bigquery.dbapi.types import STRING\n\n\napilevel = '2.0'\n\n# Threads may share the module, but not connections.\nthreadsafety = 1\n\nparamstyle = 'pyformat'\n\n__all__ = [\n    'apilevel', 'threadsafety', 'paramstyle', 'connect', 'Connection',\n    'Cursor', 'Warning', 'Error', 'InterfaceError', 'DatabaseError',\n    'DataError', 'OperationalError', 'IntegrityError', 'InternalError',\n    'ProgrammingError', 'NotSupportedError', 'Binary', 'Date', 'DateFromTicks',\n    'Time', 'TimeFromTicks', 'Timestamp', 'TimestampFromTicks', 'BINARY',\n    'DATETIME', 'NUMBER', 'ROWID', 'STRING',\n]\n", "path": "bigquery/google/cloud/bigquery/dbapi/__init__.py"}], "after_files": [{"content": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n#  Unless required by applicable law or agreed to in writing, software\n#  distributed under the License is distributed on an \"AS IS\" BASIS,\n#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#  See the License for the specific language governing permissions and\n#  limitations under the License.\n\n\"\"\"Google BigQuery implementation of the Database API Specification v2.0.\n\nThis module implements the `Python Database API Specification v2.0 (DB-API)`_\nfor Google BigQuery.\n\n.. _Python Database API Specification v2.0 (DB-API):\n   https://www.python.org/dev/peps/pep-0249/\n\n.. warning::\n   The ``dbapi`` module is **alpha**. The implementation is not complete. It\n   might be changed in backward-incompatible ways and is not subject to any SLA\n   or deprecation policy.\n\"\"\"\n\nfrom google.cloud.bigquery.dbapi.connection import connect\nfrom google.cloud.bigquery.dbapi.connection import Connection\nfrom google.cloud.bigquery.dbapi.cursor import Cursor\nfrom google.cloud.bigquery.dbapi.exceptions import Warning\nfrom google.cloud.bigquery.dbapi.exceptions import Error\nfrom google.cloud.bigquery.dbapi.exceptions import InterfaceError\nfrom google.cloud.bigquery.dbapi.exceptions import DatabaseError\nfrom google.cloud.bigquery.dbapi.exceptions import DataError\nfrom google.cloud.bigquery.dbapi.exceptions import OperationalError\nfrom google.cloud.bigquery.dbapi.exceptions import IntegrityError\nfrom google.cloud.bigquery.dbapi.exceptions import InternalError\nfrom google.cloud.bigquery.dbapi.exceptions import ProgrammingError\nfrom google.cloud.bigquery.dbapi.exceptions import NotSupportedError\nfrom google.cloud.bigquery.dbapi.types import Binary\nfrom google.cloud.bigquery.dbapi.types import Date\nfrom google.cloud.bigquery.dbapi.types import DateFromTicks\nfrom google.cloud.bigquery.dbapi.types import Time\nfrom google.cloud.bigquery.dbapi.types import TimeFromTicks\nfrom google.cloud.bigquery.dbapi.types import Timestamp\nfrom google.cloud.bigquery.dbapi.types import TimestampFromTicks\nfrom google.cloud.bigquery.dbapi.types import BINARY\nfrom google.cloud.bigquery.dbapi.types import DATETIME\nfrom google.cloud.bigquery.dbapi.types import NUMBER\nfrom google.cloud.bigquery.dbapi.types import ROWID\nfrom google.cloud.bigquery.dbapi.types import STRING\n\n\napilevel = '2.0'\n\n# Threads may share the module and connections, but not cursors.\nthreadsafety = 2\n\nparamstyle = 'pyformat'\n\n__all__ = [\n    'apilevel', 'threadsafety', 'paramstyle', 'connect', 'Connection',\n    'Cursor', 'Warning', 'Error', 'InterfaceError', 'DatabaseError',\n    'DataError', 'OperationalError', 'IntegrityError', 'InternalError',\n    'ProgrammingError', 'NotSupportedError', 'Binary', 'Date', 'DateFromTicks',\n    'Time', 'TimeFromTicks', 'Timestamp', 'TimestampFromTicks', 'BINARY',\n    'DATETIME', 'NUMBER', 'ROWID', 'STRING',\n]\n", "path": "bigquery/google/cloud/bigquery/dbapi/__init__.py"}]}