prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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.
  
  
  </issue>
  <code>
  [start of examples/embed/json_item.py]
  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 of examples/embed/json_item.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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>
   """)
  
verification_info: {"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"}]}