We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Update to_query_str to intelligently handle lists


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `falcon/util.py`
Content:
```
1 """Defines Falcon utility functions
2 
3 Copyright 2013 by Rackspace Hosting, Inc.
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9    http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 
17 """
18 
19 import datetime
20 import six
21 
22 if six.PY3:  # pragma nocover
23     from urllib.parse import quote as url_quote
24 else:  # pragma nocover
25     from urllib import quote as url_quote
26 
27 
28 __all__ = ('dt_to_http', 'http_date_to_dt', 'to_query_str', 'percent_escape')
29 
30 
31 def dt_to_http(dt):
32     """Converts a datetime instance to an HTTP date string.
33 
34     Args:
35         dt: A datetime object, assumed to be UTC
36 
37     Returns:
38         An HTTP date string, e.g., "Tue, 15 Nov 1994 12:45:26 GMT". See
39         also: http://goo.gl/R7So4
40     """
41 
42     # Tue, 15 Nov 1994 12:45:26 GMT
43     return dt.strftime('%a, %d %b %Y %H:%M:%S GMT')
44 
45 
46 def http_date_to_dt(http_date):
47     """Converts an HTTP date string to a datetime instance.
48 
49     Args:
50         http_date: An HTTP date string, e.g., "Tue, 15 Nov 1994 12:45:26 GMT".
51 
52     Returns:
53         A UTC datetime instance corresponding to the given HTTP date.
54     """
55 
56     return datetime.datetime.strptime(
57         http_date, '%a, %d %b %Y %H:%M:%S %Z')
58 
59 
60 def to_query_str(params):
61     """Converts a dict of params to afaln actual query string.
62 
63     Args:
64         params: dict of simple key-value types, where key is a string and
65             value is a string or something that can be converted into a
66             string.
67 
68     Returns:
69         A URI query string starting with '?', or and empty string if there
70         are no params (the dict is empty).
71     """
72 
73     if not params:
74         return ''
75 
76     # PERF: This is faster than a list comprehension and join, mainly
77     # because it allows us to inline the value transform.
78     query_str = '?'
79     for k, v in params.items():
80         if v is True:
81             v = 'true'
82         elif v is False:
83             v = 'false'
84         else:
85             v = str(v)
86 
87         query_str += k + '=' + v + '&'
88 
89     return query_str[:-1]
90 
91 
92 def percent_escape(url):
93     """Percent-escape reserved characters in the given url.
94 
95     Args:
96         url: A full or relative URL.
97 
98     Returns:
99         An escaped version of the URL, excluding '/', ',' and ':'
100         characters. In Python 2, unicode URL strings will be first
101         encoded to a UTF-8 byte string to work around a urllib
102         bug.
103     """
104 
105     # Convert the string so that urllib.quote does not complain
106     # if it actually has Unicode chars in it.
107     if not six.PY3 and isinstance(url, six.text_type):  # pragma nocover
108         url = url.encode('utf-8')
109 
110     return url_quote(url, safe='/:,=?&-_')
111
```
--- 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/falcon/util.py b/falcon/util.py
--- a/falcon/util.py
+++ b/falcon/util.py
@@ -63,7 +63,8 @@
     Args:
         params: dict of simple key-value types, where key is a string and
             value is a string or something that can be converted into a
-            string.
+            string. If value is a list, it will be converted to a comma-
+            delimited string (e.g., thing=1,2,3)
 
     Returns:
         A URI query string starting with '?', or and empty string if there
@@ -81,6 +82,8 @@
             v = 'true'
         elif v is False:
             v = 'false'
+        elif isinstance(v, list):
+            v = ','.join([str(i) for i in v])
         else:
             v = str(v)

{"golden_diff": "diff --git a/falcon/util.py b/falcon/util.py\n--- a/falcon/util.py\n+++ b/falcon/util.py\n@@ -63,7 +63,8 @@\n     Args:\n         params: dict of simple key-value types, where key is a string and\n             value is a string or something that can be converted into a\n-            string.\n+            string. If value is a list, it will be converted to a comma-\n+            delimited string (e.g., thing=1,2,3)\n \n     Returns:\n         A URI query string starting with '?', or and empty string if there\n@@ -81,6 +82,8 @@\n             v = 'true'\n         elif v is False:\n             v = 'false'\n+        elif isinstance(v, list):\n+            v = ','.join([str(i) for i in v])\n         else:\n             v = str(v)\n", "issue": "Update to_query_str to intelligently handle lists\n\n", "before_files": [{"content": "\"\"\"Defines Falcon utility functions\n\nCopyright 2013 by Rackspace Hosting, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\"\"\"\n\nimport datetime\nimport six\n\nif six.PY3:  # pragma nocover\n    from urllib.parse import quote as url_quote\nelse:  # pragma nocover\n    from urllib import quote as url_quote\n\n\n__all__ = ('dt_to_http', 'http_date_to_dt', 'to_query_str', 'percent_escape')\n\n\ndef dt_to_http(dt):\n    \"\"\"Converts a datetime instance to an HTTP date string.\n\n    Args:\n        dt: A datetime object, assumed to be UTC\n\n    Returns:\n        An HTTP date string, e.g., \"Tue, 15 Nov 1994 12:45:26 GMT\". See\n        also: http://goo.gl/R7So4\n    \"\"\"\n\n    # Tue, 15 Nov 1994 12:45:26 GMT\n    return dt.strftime('%a, %d %b %Y %H:%M:%S GMT')\n\n\ndef http_date_to_dt(http_date):\n    \"\"\"Converts an HTTP date string to a datetime instance.\n\n    Args:\n        http_date: An HTTP date string, e.g., \"Tue, 15 Nov 1994 12:45:26 GMT\".\n\n    Returns:\n        A UTC datetime instance corresponding to the given HTTP date.\n    \"\"\"\n\n    return datetime.datetime.strptime(\n        http_date, '%a, %d %b %Y %H:%M:%S %Z')\n\n\ndef to_query_str(params):\n    \"\"\"Converts a dict of params to afaln actual query string.\n\n    Args:\n        params: dict of simple key-value types, where key is a string and\n            value is a string or something that can be converted into a\n            string.\n\n    Returns:\n        A URI query string starting with '?', or and empty string if there\n        are no params (the dict is empty).\n    \"\"\"\n\n    if not params:\n        return ''\n\n    # PERF: This is faster than a list comprehension and join, mainly\n    # because it allows us to inline the value transform.\n    query_str = '?'\n    for k, v in params.items():\n        if v is True:\n            v = 'true'\n        elif v is False:\n            v = 'false'\n        else:\n            v = str(v)\n\n        query_str += k + '=' + v + '&'\n\n    return query_str[:-1]\n\n\ndef percent_escape(url):\n    \"\"\"Percent-escape reserved characters in the given url.\n\n    Args:\n        url: A full or relative URL.\n\n    Returns:\n        An escaped version of the URL, excluding '/', ',' and ':'\n        characters. In Python 2, unicode URL strings will be first\n        encoded to a UTF-8 byte string to work around a urllib\n        bug.\n    \"\"\"\n\n    # Convert the string so that urllib.quote does not complain\n    # if it actually has Unicode chars in it.\n    if not six.PY3 and isinstance(url, six.text_type):  # pragma nocover\n        url = url.encode('utf-8')\n\n    return url_quote(url, safe='/:,=?&-_')\n", "path": "falcon/util.py"}], "after_files": [{"content": "\"\"\"Defines Falcon utility functions\n\nCopyright 2013 by Rackspace Hosting, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\"\"\"\n\nimport datetime\nimport six\n\nif six.PY3:  # pragma nocover\n    from urllib.parse import quote as url_quote\nelse:  # pragma nocover\n    from urllib import quote as url_quote\n\n\n__all__ = ('dt_to_http', 'http_date_to_dt', 'to_query_str', 'percent_escape')\n\n\ndef dt_to_http(dt):\n    \"\"\"Converts a datetime instance to an HTTP date string.\n\n    Args:\n        dt: A datetime object, assumed to be UTC\n\n    Returns:\n        An HTTP date string, e.g., \"Tue, 15 Nov 1994 12:45:26 GMT\". See\n        also: http://goo.gl/R7So4\n    \"\"\"\n\n    # Tue, 15 Nov 1994 12:45:26 GMT\n    return dt.strftime('%a, %d %b %Y %H:%M:%S GMT')\n\n\ndef http_date_to_dt(http_date):\n    \"\"\"Converts an HTTP date string to a datetime instance.\n\n    Args:\n        http_date: An HTTP date string, e.g., \"Tue, 15 Nov 1994 12:45:26 GMT\".\n\n    Returns:\n        A UTC datetime instance corresponding to the given HTTP date.\n    \"\"\"\n\n    return datetime.datetime.strptime(\n        http_date, '%a, %d %b %Y %H:%M:%S %Z')\n\n\ndef to_query_str(params):\n    \"\"\"Converts a dict of params to afaln actual query string.\n\n    Args:\n        params: dict of simple key-value types, where key is a string and\n            value is a string or something that can be converted into a\n            string. If value is a list, it will be converted to a comma-\n            delimited string (e.g., thing=1,2,3)\n\n    Returns:\n        A URI query string starting with '?', or and empty string if there\n        are no params (the dict is empty).\n    \"\"\"\n\n    if not params:\n        return ''\n\n    # PERF: This is faster than a list comprehension and join, mainly\n    # because it allows us to inline the value transform.\n    query_str = '?'\n    for k, v in params.items():\n        if v is True:\n            v = 'true'\n        elif v is False:\n            v = 'false'\n        elif isinstance(v, list):\n            v = ','.join([str(i) for i in v])\n        else:\n            v = str(v)\n\n        query_str += k + '=' + v + '&'\n\n    return query_str[:-1]\n\n\ndef percent_escape(url):\n    \"\"\"Percent-escape reserved characters in the given url.\n\n    Args:\n        url: A full or relative URL.\n\n    Returns:\n        An escaped version of the URL, excluding '/', ',' and ':'\n        characters. In Python 2, unicode URL strings will be first\n        encoded to a UTF-8 byte string to work around a urllib\n        bug.\n    \"\"\"\n\n    # Convert the string so that urllib.quote does not complain\n    # if it actually has Unicode chars in it.\n    if not six.PY3 and isinstance(url, six.text_type):  # pragma nocover\n        url = url.encode('utf-8')\n\n    return url_quote(url, safe='/:,=?&-_')\n", "path": "falcon/util.py"}]}