We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[FEATURE] BokehJS embed_item should return a reference to the plot. 
Bokeh.embed.embed_item currently returns nothing. I propose it should return a reference to the plot object so I don't have to go fishing (Bokeh.index[plotData.root_id]) in Bokeh.index to do things like call resize_layout() manually.

Honestly any sort of 'official' method for doing this would be super useful.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/embed/json_item.py`
Content:
```
1 import json
2 
3 from flask import Flask
4 from jinja2 import Template
5 
6 from bokeh.embed import json_item
7 from bokeh.plotting import figure
8 from bokeh.resources import CDN
9 from bokeh.sampledata.iris import flowers
10 
11 app = Flask(__name__)
12 
13 page = Template("""
14 <!DOCTYPE html>
15 <html lang="en">
16 <head>
17   {{ resources }}
18 </head>
19 
20 <body>
21   <div id="myplot"></div>
22   <div id="myplot2"></div>
23   <script>
24   fetch('/plot')
25     .then(function(response) { return response.json(); })
26     .then(function(item) { Bokeh.embed.embed_item(item); })
27   </script>
28   <script>
29   fetch('/plot2')
30     .then(function(response) { return response.json(); })
31     .then(function(item) { Bokeh.embed.embed_item(item, "myplot2"); })
32   </script>
33 </body>
34 """)
35 
36 colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
37 colors = [colormap[x] for x in flowers['species']]
38 
39 def make_plot(x, y):
40     p = figure(title = "Iris Morphology", sizing_mode="fixed", plot_width=400, plot_height=400)
41     p.xaxis.axis_label = x
42     p.yaxis.axis_label = y
43     p.circle(flowers[x], flowers[y], color=colors, fill_alpha=0.2, size=10)
44     return p
45 
46 @app.route('/')
47 def root():
48     return page.render(resources=CDN.render())
49 
50 @app.route('/plot')
51 def plot():
52     p = make_plot('petal_width', 'petal_length')
53     return json.dumps(json_item(p, "myplot"))
54 
55 @app.route('/plot2')
56 def plot2():
57     p = make_plot('sepal_width', 'sepal_length')
58     return json.dumps(json_item(p))
59 
60 if __name__ == '__main__':
61     app.run()
62
```
--- 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/examples/embed/json_item.py b/examples/embed/json_item.py
--- a/examples/embed/json_item.py
+++ b/examples/embed/json_item.py
@@ -23,12 +23,12 @@
   <script>
   fetch('/plot')
     .then(function(response) { return response.json(); })
-    .then(function(item) { Bokeh.embed.embed_item(item); })
+    .then(function(item) { return Bokeh.embed.embed_item(item); })
   </script>
   <script>
   fetch('/plot2')
     .then(function(response) { return response.json(); })
-    .then(function(item) { Bokeh.embed.embed_item(item, "myplot2"); })
+    .then(function(item) { return Bokeh.embed.embed_item(item, "myplot2"); })
   </script>
 </body>
 """)

{"golden_diff": "diff --git a/examples/embed/json_item.py b/examples/embed/json_item.py\n--- a/examples/embed/json_item.py\n+++ b/examples/embed/json_item.py\n@@ -23,12 +23,12 @@\n   <script>\n   fetch('/plot')\n     .then(function(response) { return response.json(); })\n-    .then(function(item) { Bokeh.embed.embed_item(item); })\n+    .then(function(item) { return Bokeh.embed.embed_item(item); })\n   </script>\n   <script>\n   fetch('/plot2')\n     .then(function(response) { return response.json(); })\n-    .then(function(item) { Bokeh.embed.embed_item(item, \"myplot2\"); })\n+    .then(function(item) { return Bokeh.embed.embed_item(item, \"myplot2\"); })\n   </script>\n </body>\n \"\"\")\n", "issue": "[FEATURE] BokehJS embed_item should return a reference to the plot. \nBokeh.embed.embed_item currently returns nothing. I propose it should return a reference to the plot object so I don't have to go fishing (Bokeh.index[plotData.root_id]) in Bokeh.index to do things like call resize_layout() manually.\r\n\r\nHonestly any sort of 'official' method for doing this would be super useful.\r\n\n", "before_files": [{"content": "import json\n\nfrom flask import Flask\nfrom jinja2 import Template\n\nfrom bokeh.embed import json_item\nfrom bokeh.plotting import figure\nfrom bokeh.resources import CDN\nfrom bokeh.sampledata.iris import flowers\n\napp = Flask(__name__)\n\npage = Template(\"\"\"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  {{ resources }}\n</head>\n\n<body>\n  <div id=\"myplot\"></div>\n  <div id=\"myplot2\"></div>\n  <script>\n  fetch('/plot')\n    .then(function(response) { return response.json(); })\n    .then(function(item) { Bokeh.embed.embed_item(item); })\n  </script>\n  <script>\n  fetch('/plot2')\n    .then(function(response) { return response.json(); })\n    .then(function(item) { Bokeh.embed.embed_item(item, \"myplot2\"); })\n  </script>\n</body>\n\"\"\")\n\ncolormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}\ncolors = [colormap[x] for x in flowers['species']]\n\ndef make_plot(x, y):\n    p = figure(title = \"Iris Morphology\", sizing_mode=\"fixed\", plot_width=400, plot_height=400)\n    p.xaxis.axis_label = x\n    p.yaxis.axis_label = y\n    p.circle(flowers[x], flowers[y], color=colors, fill_alpha=0.2, size=10)\n    return p\n\n@app.route('/')\ndef root():\n    return page.render(resources=CDN.render())\n\n@app.route('/plot')\ndef plot():\n    p = make_plot('petal_width', 'petal_length')\n    return json.dumps(json_item(p, \"myplot\"))\n\n@app.route('/plot2')\ndef plot2():\n    p = make_plot('sepal_width', 'sepal_length')\n    return json.dumps(json_item(p))\n\nif __name__ == '__main__':\n    app.run()\n", "path": "examples/embed/json_item.py"}], "after_files": [{"content": "import json\n\nfrom flask import Flask\nfrom jinja2 import Template\n\nfrom bokeh.embed import json_item\nfrom bokeh.plotting import figure\nfrom bokeh.resources import CDN\nfrom bokeh.sampledata.iris import flowers\n\napp = Flask(__name__)\n\npage = Template(\"\"\"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  {{ resources }}\n</head>\n\n<body>\n  <div id=\"myplot\"></div>\n  <div id=\"myplot2\"></div>\n  <script>\n  fetch('/plot')\n    .then(function(response) { return response.json(); })\n    .then(function(item) { return Bokeh.embed.embed_item(item); })\n  </script>\n  <script>\n  fetch('/plot2')\n    .then(function(response) { return response.json(); })\n    .then(function(item) { return Bokeh.embed.embed_item(item, \"myplot2\"); })\n  </script>\n</body>\n\"\"\")\n\ncolormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}\ncolors = [colormap[x] for x in flowers['species']]\n\ndef make_plot(x, y):\n    p = figure(title = \"Iris Morphology\", sizing_mode=\"fixed\", plot_width=400, plot_height=400)\n    p.xaxis.axis_label = x\n    p.yaxis.axis_label = y\n    p.circle(flowers[x], flowers[y], color=colors, fill_alpha=0.2, size=10)\n    return p\n\n@app.route('/')\ndef root():\n    return page.render(resources=CDN.render())\n\n@app.route('/plot')\ndef plot():\n    p = make_plot('petal_width', 'petal_length')\n    return json.dumps(json_item(p, \"myplot\"))\n\n@app.route('/plot2')\ndef plot2():\n    p = make_plot('sepal_width', 'sepal_length')\n    return json.dumps(json_item(p))\n\nif __name__ == '__main__':\n    app.run()\n", "path": "examples/embed/json_item.py"}]}