We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Customize warning formatter
I'm trying out the imminent bokeh release with the dask dashboard.  I get hundreds of lines like the following:

```python
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/bokeh/models/sources.py:91: BokehUserWarning: ColumnD)
  "Current lengths: %s" % ", ".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))
```

Clearly I'm doing something wrong in my code, and it's great to know about it.  However, two things would make this nicer:

1.  Getting some sort of information about the cause of the failure.  It looks like an informative error message was attempted, but rather than getting a nice result I get the code instead.
2.  These are filling up my terminal at the rate that I update my plots.  It might be nice to only warn once or twice.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bokeh/__init__.py`
Content:
```
1 #-----------------------------------------------------------------------------
2 # Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
3 #
4 # Powered by the Bokeh Development Team.
5 #
6 # The full license is in the file LICENSE.txt, distributed with this software.
7 #-----------------------------------------------------------------------------
8 ''' Bokeh is a Python interactive visualization library that targets modern
9 web browsers for presentation.
10 
11 Its goal is to provide elegant, concise construction of versatile graphics,
12 and also deliver this capability with high-performance interactivity over large
13 or streaming datasets. Bokeh can help anyone who would like to quickly and
14 easily create interactive plots, dashboards, and data applications.
15 
16 For full documentation, please visit: https://bokeh.pydata.org
17 
18 '''
19 
20 #-----------------------------------------------------------------------------
21 # Boilerplate
22 #-----------------------------------------------------------------------------
23 from __future__ import absolute_import, division, print_function, unicode_literals
24 
25 import logging
26 log = logging.getLogger(__name__)
27 
28 #-----------------------------------------------------------------------------
29 # General API
30 #-----------------------------------------------------------------------------
31 
32 __all__ = (
33     '__version__',
34     'license',
35     'sampledata',
36 )
37 
38 # configure Bokeh version
39 from .util.version import __version__; __version__
40 
41 def license():
42     ''' Print the Bokeh license to the console.
43 
44     Returns:
45         None
46 
47     '''
48     from os.path import join
49     with open(join(__path__[0], 'LICENSE.txt')) as lic:
50         print(lic.read())
51 
52 # expose sample data module
53 from . import sampledata; sampledata
54 
55 #-----------------------------------------------------------------------------
56 # Code
57 #-----------------------------------------------------------------------------
58 
59 # configure Bokeh logger
60 from .util import logconfig
61 del logconfig
62 
63 # Configure warnings to always show, despite Python's active efforts to hide them from users.
64 import warnings
65 from .util.warnings import BokehDeprecationWarning, BokehUserWarning
66 warnings.simplefilter('always', BokehDeprecationWarning)
67 warnings.simplefilter('always', BokehUserWarning)
68 del BokehDeprecationWarning, BokehUserWarning
69 del warnings
70
```
--- 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/bokeh/__init__.py b/bokeh/__init__.py
--- a/bokeh/__init__.py
+++ b/bokeh/__init__.py
@@ -60,10 +60,21 @@
 from .util import logconfig
 del logconfig
 
-# Configure warnings to always show, despite Python's active efforts to hide them from users.
+# Configure warnings to always show nice mssages, despite Python's active
+# efforts to hide them from users.
 import warnings
 from .util.warnings import BokehDeprecationWarning, BokehUserWarning
 warnings.simplefilter('always', BokehDeprecationWarning)
 warnings.simplefilter('always', BokehUserWarning)
+
+original_formatwarning = warnings.formatwarning
+def _formatwarning(message, category, filename, lineno, line=None):
+    from .util.warnings import BokehDeprecationWarning, BokehUserWarning
+    if category not in (BokehDeprecationWarning, BokehUserWarning):
+        return original_formatwarning(message, category, filename, lineno, line)
+    return "%s: %s\n" % (category.__name__, message)
+warnings.formatwarning = _formatwarning
+
+del _formatwarning
 del BokehDeprecationWarning, BokehUserWarning
 del warnings

{"golden_diff": "diff --git a/bokeh/__init__.py b/bokeh/__init__.py\n--- a/bokeh/__init__.py\n+++ b/bokeh/__init__.py\n@@ -60,10 +60,21 @@\n from .util import logconfig\n del logconfig\n \n-# Configure warnings to always show, despite Python's active efforts to hide them from users.\n+# Configure warnings to always show nice mssages, despite Python's active\n+# efforts to hide them from users.\n import warnings\n from .util.warnings import BokehDeprecationWarning, BokehUserWarning\n warnings.simplefilter('always', BokehDeprecationWarning)\n warnings.simplefilter('always', BokehUserWarning)\n+\n+original_formatwarning = warnings.formatwarning\n+def _formatwarning(message, category, filename, lineno, line=None):\n+    from .util.warnings import BokehDeprecationWarning, BokehUserWarning\n+    if category not in (BokehDeprecationWarning, BokehUserWarning):\n+        return original_formatwarning(message, category, filename, lineno, line)\n+    return \"%s: %s\\n\" % (category.__name__, message)\n+warnings.formatwarning = _formatwarning\n+\n+del _formatwarning\n del BokehDeprecationWarning, BokehUserWarning\n del warnings\n", "issue": "Customize warning formatter\nI'm trying out the imminent bokeh release with the dask dashboard.  I get hundreds of lines like the following:\r\n\r\n```python\r\n/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/bokeh/models/sources.py:91: BokehUserWarning: ColumnD)\r\n  \"Current lengths: %s\" % \", \".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))\r\n```\r\n\r\nClearly I'm doing something wrong in my code, and it's great to know about it.  However, two things would make this nicer:\r\n\r\n1.  Getting some sort of information about the cause of the failure.  It looks like an informative error message was attempted, but rather than getting a nice result I get the code instead.\r\n2.  These are filling up my terminal at the rate that I update my plots.  It might be nice to only warn once or twice.\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.\n#\n# Powered by the Bokeh Development Team.\n#\n# The full license is in the file LICENSE.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n''' Bokeh is a Python interactive visualization library that targets modern\nweb browsers for presentation.\n\nIts goal is to provide elegant, concise construction of versatile graphics,\nand also deliver this capability with high-performance interactivity over large\nor streaming datasets. Bokeh can help anyone who would like to quickly and\neasily create interactive plots, dashboards, and data applications.\n\nFor full documentation, please visit: https://bokeh.pydata.org\n\n'''\n\n#-----------------------------------------------------------------------------\n# Boilerplate\n#-----------------------------------------------------------------------------\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport logging\nlog = logging.getLogger(__name__)\n\n#-----------------------------------------------------------------------------\n# General API\n#-----------------------------------------------------------------------------\n\n__all__ = (\n    '__version__',\n    'license',\n    'sampledata',\n)\n\n# configure Bokeh version\nfrom .util.version import __version__; __version__\n\ndef license():\n    ''' Print the Bokeh license to the console.\n\n    Returns:\n        None\n\n    '''\n    from os.path import join\n    with open(join(__path__[0], 'LICENSE.txt')) as lic:\n        print(lic.read())\n\n# expose sample data module\nfrom . import sampledata; sampledata\n\n#-----------------------------------------------------------------------------\n# Code\n#-----------------------------------------------------------------------------\n\n# configure Bokeh logger\nfrom .util import logconfig\ndel logconfig\n\n# Configure warnings to always show, despite Python's active efforts to hide them from users.\nimport warnings\nfrom .util.warnings import BokehDeprecationWarning, BokehUserWarning\nwarnings.simplefilter('always', BokehDeprecationWarning)\nwarnings.simplefilter('always', BokehUserWarning)\ndel BokehDeprecationWarning, BokehUserWarning\ndel warnings\n", "path": "bokeh/__init__.py"}], "after_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.\n#\n# Powered by the Bokeh Development Team.\n#\n# The full license is in the file LICENSE.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n''' Bokeh is a Python interactive visualization library that targets modern\nweb browsers for presentation.\n\nIts goal is to provide elegant, concise construction of versatile graphics,\nand also deliver this capability with high-performance interactivity over large\nor streaming datasets. Bokeh can help anyone who would like to quickly and\neasily create interactive plots, dashboards, and data applications.\n\nFor full documentation, please visit: https://bokeh.pydata.org\n\n'''\n\n#-----------------------------------------------------------------------------\n# Boilerplate\n#-----------------------------------------------------------------------------\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport logging\nlog = logging.getLogger(__name__)\n\n#-----------------------------------------------------------------------------\n# General API\n#-----------------------------------------------------------------------------\n\n__all__ = (\n    '__version__',\n    'license',\n    'sampledata',\n)\n\n# configure Bokeh version\nfrom .util.version import __version__; __version__\n\ndef license():\n    ''' Print the Bokeh license to the console.\n\n    Returns:\n        None\n\n    '''\n    from os.path import join\n    with open(join(__path__[0], 'LICENSE.txt')) as lic:\n        print(lic.read())\n\n# expose sample data module\nfrom . import sampledata; sampledata\n\n#-----------------------------------------------------------------------------\n# Code\n#-----------------------------------------------------------------------------\n\n# configure Bokeh logger\nfrom .util import logconfig\ndel logconfig\n\n# Configure warnings to always show nice mssages, despite Python's active\n# efforts to hide them from users.\nimport warnings\nfrom .util.warnings import BokehDeprecationWarning, BokehUserWarning\nwarnings.simplefilter('always', BokehDeprecationWarning)\nwarnings.simplefilter('always', BokehUserWarning)\n\noriginal_formatwarning = warnings.formatwarning\ndef _formatwarning(message, category, filename, lineno, line=None):\n    from .util.warnings import BokehDeprecationWarning, BokehUserWarning\n    if category not in (BokehDeprecationWarning, BokehUserWarning):\n        return original_formatwarning(message, category, filename, lineno, line)\n    return \"%s: %s\\n\" % (category.__name__, message)\nwarnings.formatwarning = _formatwarning\n\ndel _formatwarning\ndel BokehDeprecationWarning, BokehUserWarning\ndel warnings\n", "path": "bokeh/__init__.py"}]}