We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
histogram() got an unexpected keyword argument 'legend' with pandas backend
pandas version 1.1.0
plotly version 4.9.0

The following will raise `histogram() got an unexpected keyword argument 'legend' `:
```python
import pandas as pd
pd.options.plotting.backend = "plotly"
df = pd.DataFrame()
df.hist()
```
I suggest to add `legend` in the skip list:
https://github.com/plotly/plotly.py/blob/dc9c5fdfe70367d5dc4fcdca6a0ad07125d64647/packages/python/plotly/plotly/__init__.py#L161

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `packages/python/plotly/plotly/__init__.py`
Content:
```
1 """
2 https://plot.ly/python/
3 
4 Plotly's Python API allows users to programmatically access Plotly's
5 server resources.
6 
7 This package is organized as follows:
8 
9 Subpackages:
10 
11 - plotly: all functionality that requires access to Plotly's servers
12 
13 - graph_objs: objects for designing figures and visualizing data
14 
15 - matplotlylib: tools to convert matplotlib figures
16 
17 Modules:
18 
19 - tools: some helpful tools that do not require access to Plotly's servers
20 
21 - utils: functions that you probably won't need, but that subpackages use
22 
23 - version: holds the current API version
24 
25 - exceptions: defines our custom exception classes
26 
27 """
28 from __future__ import absolute_import
29 import sys
30 from _plotly_utils.importers import relative_import
31 
32 
33 if sys.version_info < (3, 7):
34     from plotly import (
35         graph_objs,
36         tools,
37         utils,
38         offline,
39         colors,
40         io,
41         data,
42     )
43     from plotly.version import __version__
44 
45     __all__ = [
46         "graph_objs",
47         "tools",
48         "utils",
49         "offline",
50         "colors",
51         "io",
52         "data",
53         "__version__",
54     ]
55 
56     # Set default template (for >= 3.7 this is done in ploty/io/__init__.py)
57     from plotly.io import templates
58 
59     templates._default = "plotly"
60 else:
61     __all__, __getattr__, __dir__ = relative_import(
62         __name__,
63         [
64             ".graph_objs",
65             ".graph_objects",
66             ".tools",
67             ".utils",
68             ".offline",
69             ".colors",
70             ".io",
71             ".data",
72         ],
73         [".version.__version__"],
74     )
75 
76 
77 def plot(data_frame, kind, **kwargs):
78     """
79     Pandas plotting backend function, not meant to be called directly.
80     To activate, set pandas.options.plotting.backend="plotly"
81     See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
82     """
83     from .express import (
84         scatter,
85         line,
86         area,
87         bar,
88         box,
89         histogram,
90         violin,
91         strip,
92         funnel,
93         density_contour,
94         density_heatmap,
95         imshow,
96     )
97 
98     if kind == "scatter":
99         new_kwargs = {k: kwargs[k] for k in kwargs if k not in ["s", "c"]}
100         return scatter(data_frame, **new_kwargs)
101     if kind == "line":
102         return line(data_frame, **kwargs)
103     if kind == "area":
104         return area(data_frame, **kwargs)
105     if kind == "bar":
106         return bar(data_frame, **kwargs)
107     if kind == "barh":
108         return bar(data_frame, orientation="h", **kwargs)
109     if kind == "box":
110         new_kwargs = {k: kwargs[k] for k in kwargs if k not in ["by"]}
111         return box(data_frame, **new_kwargs)
112     if kind in ["hist", "histogram"]:
113         new_kwargs = {k: kwargs[k] for k in kwargs if k not in ["by", "bins"]}
114         return histogram(data_frame, **new_kwargs)
115     if kind == "violin":
116         return violin(data_frame, **kwargs)
117     if kind == "strip":
118         return strip(data_frame, **kwargs)
119     if kind == "funnel":
120         return funnel(data_frame, **kwargs)
121     if kind == "density_contour":
122         return density_contour(data_frame, **kwargs)
123     if kind == "density_heatmap":
124         return density_heatmap(data_frame, **kwargs)
125     if kind == "imshow":
126         return imshow(data_frame, **kwargs)
127     if kind == "heatmap":
128         raise ValueError(
129             "kind='heatmap' not supported plotting.backend='plotly'. "
130             "Please use kind='imshow' or kind='density_heatmap'."
131         )
132 
133     raise NotImplementedError(
134         "kind='%s' not yet supported for plotting.backend='plotly'" % kind
135     )
136 
137 
138 def boxplot_frame(data_frame, **kwargs):
139     """
140     Pandas plotting backend function, not meant to be called directly.
141     To activate, set pandas.options.plotting.backend="plotly"
142     See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
143     """
144     from .express import box
145 
146     skip = ["by", "column", "ax", "fontsize", "rot", "grid", "figsize", "layout"]
147     skip += ["return_type"]
148     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}
149     return box(data_frame, **new_kwargs)
150 
151 
152 def hist_frame(data_frame, **kwargs):
153     """
154     Pandas plotting backend function, not meant to be called directly.
155     To activate, set pandas.options.plotting.backend="plotly"
156     See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
157     """
158     from .express import histogram
159 
160     skip = ["column", "by", "grid", "xlabelsize", "xrot", "ylabelsize", "yrot"]
161     skip += ["ax", "sharex", "sharey", "figsize", "layout", "bins"]
162     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}
163     return histogram(data_frame, **new_kwargs)
164 
165 
166 def hist_series(data_frame, **kwargs):
167     """
168     Pandas plotting backend function, not meant to be called directly.
169     To activate, set pandas.options.plotting.backend="plotly"
170     See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
171     """
172     from .express import histogram
173 
174     skip = ["by", "grid", "xlabelsize", "xrot", "ylabelsize", "yrot", "ax"]
175     skip += ["figsize", "bins"]
176     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}
177     return histogram(data_frame, **new_kwargs)
178
```
--- 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/packages/python/plotly/plotly/__init__.py b/packages/python/plotly/plotly/__init__.py
--- a/packages/python/plotly/plotly/__init__.py
+++ b/packages/python/plotly/plotly/__init__.py
@@ -158,7 +158,7 @@
     from .express import histogram
 
     skip = ["column", "by", "grid", "xlabelsize", "xrot", "ylabelsize", "yrot"]
-    skip += ["ax", "sharex", "sharey", "figsize", "layout", "bins"]
+    skip += ["ax", "sharex", "sharey", "figsize", "layout", "bins", "legend"]
     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}
     return histogram(data_frame, **new_kwargs)
 
@@ -172,6 +172,6 @@
     from .express import histogram
 
     skip = ["by", "grid", "xlabelsize", "xrot", "ylabelsize", "yrot", "ax"]
-    skip += ["figsize", "bins"]
+    skip += ["figsize", "bins", "legend"]
     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}
     return histogram(data_frame, **new_kwargs)

{"golden_diff": "diff --git a/packages/python/plotly/plotly/__init__.py b/packages/python/plotly/plotly/__init__.py\n--- a/packages/python/plotly/plotly/__init__.py\n+++ b/packages/python/plotly/plotly/__init__.py\n@@ -158,7 +158,7 @@\n     from .express import histogram\n \n     skip = [\"column\", \"by\", \"grid\", \"xlabelsize\", \"xrot\", \"ylabelsize\", \"yrot\"]\n-    skip += [\"ax\", \"sharex\", \"sharey\", \"figsize\", \"layout\", \"bins\"]\n+    skip += [\"ax\", \"sharex\", \"sharey\", \"figsize\", \"layout\", \"bins\", \"legend\"]\n     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n     return histogram(data_frame, **new_kwargs)\n \n@@ -172,6 +172,6 @@\n     from .express import histogram\n \n     skip = [\"by\", \"grid\", \"xlabelsize\", \"xrot\", \"ylabelsize\", \"yrot\", \"ax\"]\n-    skip += [\"figsize\", \"bins\"]\n+    skip += [\"figsize\", \"bins\", \"legend\"]\n     new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n     return histogram(data_frame, **new_kwargs)\n", "issue": "histogram() got an unexpected keyword argument 'legend' with pandas backend\npandas version 1.1.0\r\nplotly version 4.9.0\r\n\r\nThe following will raise `histogram() got an unexpected keyword argument 'legend' `:\r\n```python\r\nimport pandas as pd\r\npd.options.plotting.backend = \"plotly\"\r\ndf = pd.DataFrame()\r\ndf.hist()\r\n```\r\nI suggest to add `legend` in the skip list:\r\nhttps://github.com/plotly/plotly.py/blob/dc9c5fdfe70367d5dc4fcdca6a0ad07125d64647/packages/python/plotly/plotly/__init__.py#L161\n", "before_files": [{"content": "\"\"\"\nhttps://plot.ly/python/\n\nPlotly's Python API allows users to programmatically access Plotly's\nserver resources.\n\nThis package is organized as follows:\n\nSubpackages:\n\n- plotly: all functionality that requires access to Plotly's servers\n\n- graph_objs: objects for designing figures and visualizing data\n\n- matplotlylib: tools to convert matplotlib figures\n\nModules:\n\n- tools: some helpful tools that do not require access to Plotly's servers\n\n- utils: functions that you probably won't need, but that subpackages use\n\n- version: holds the current API version\n\n- exceptions: defines our custom exception classes\n\n\"\"\"\nfrom __future__ import absolute_import\nimport sys\nfrom _plotly_utils.importers import relative_import\n\n\nif sys.version_info < (3, 7):\n    from plotly import (\n        graph_objs,\n        tools,\n        utils,\n        offline,\n        colors,\n        io,\n        data,\n    )\n    from plotly.version import __version__\n\n    __all__ = [\n        \"graph_objs\",\n        \"tools\",\n        \"utils\",\n        \"offline\",\n        \"colors\",\n        \"io\",\n        \"data\",\n        \"__version__\",\n    ]\n\n    # Set default template (for >= 3.7 this is done in ploty/io/__init__.py)\n    from plotly.io import templates\n\n    templates._default = \"plotly\"\nelse:\n    __all__, __getattr__, __dir__ = relative_import(\n        __name__,\n        [\n            \".graph_objs\",\n            \".graph_objects\",\n            \".tools\",\n            \".utils\",\n            \".offline\",\n            \".colors\",\n            \".io\",\n            \".data\",\n        ],\n        [\".version.__version__\"],\n    )\n\n\ndef plot(data_frame, kind, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import (\n        scatter,\n        line,\n        area,\n        bar,\n        box,\n        histogram,\n        violin,\n        strip,\n        funnel,\n        density_contour,\n        density_heatmap,\n        imshow,\n    )\n\n    if kind == \"scatter\":\n        new_kwargs = {k: kwargs[k] for k in kwargs if k not in [\"s\", \"c\"]}\n        return scatter(data_frame, **new_kwargs)\n    if kind == \"line\":\n        return line(data_frame, **kwargs)\n    if kind == \"area\":\n        return area(data_frame, **kwargs)\n    if kind == \"bar\":\n        return bar(data_frame, **kwargs)\n    if kind == \"barh\":\n        return bar(data_frame, orientation=\"h\", **kwargs)\n    if kind == \"box\":\n        new_kwargs = {k: kwargs[k] for k in kwargs if k not in [\"by\"]}\n        return box(data_frame, **new_kwargs)\n    if kind in [\"hist\", \"histogram\"]:\n        new_kwargs = {k: kwargs[k] for k in kwargs if k not in [\"by\", \"bins\"]}\n        return histogram(data_frame, **new_kwargs)\n    if kind == \"violin\":\n        return violin(data_frame, **kwargs)\n    if kind == \"strip\":\n        return strip(data_frame, **kwargs)\n    if kind == \"funnel\":\n        return funnel(data_frame, **kwargs)\n    if kind == \"density_contour\":\n        return density_contour(data_frame, **kwargs)\n    if kind == \"density_heatmap\":\n        return density_heatmap(data_frame, **kwargs)\n    if kind == \"imshow\":\n        return imshow(data_frame, **kwargs)\n    if kind == \"heatmap\":\n        raise ValueError(\n            \"kind='heatmap' not supported plotting.backend='plotly'. \"\n            \"Please use kind='imshow' or kind='density_heatmap'.\"\n        )\n\n    raise NotImplementedError(\n        \"kind='%s' not yet supported for plotting.backend='plotly'\" % kind\n    )\n\n\ndef boxplot_frame(data_frame, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import box\n\n    skip = [\"by\", \"column\", \"ax\", \"fontsize\", \"rot\", \"grid\", \"figsize\", \"layout\"]\n    skip += [\"return_type\"]\n    new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n    return box(data_frame, **new_kwargs)\n\n\ndef hist_frame(data_frame, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import histogram\n\n    skip = [\"column\", \"by\", \"grid\", \"xlabelsize\", \"xrot\", \"ylabelsize\", \"yrot\"]\n    skip += [\"ax\", \"sharex\", \"sharey\", \"figsize\", \"layout\", \"bins\"]\n    new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n    return histogram(data_frame, **new_kwargs)\n\n\ndef hist_series(data_frame, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import histogram\n\n    skip = [\"by\", \"grid\", \"xlabelsize\", \"xrot\", \"ylabelsize\", \"yrot\", \"ax\"]\n    skip += [\"figsize\", \"bins\"]\n    new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n    return histogram(data_frame, **new_kwargs)\n", "path": "packages/python/plotly/plotly/__init__.py"}], "after_files": [{"content": "\"\"\"\nhttps://plot.ly/python/\n\nPlotly's Python API allows users to programmatically access Plotly's\nserver resources.\n\nThis package is organized as follows:\n\nSubpackages:\n\n- plotly: all functionality that requires access to Plotly's servers\n\n- graph_objs: objects for designing figures and visualizing data\n\n- matplotlylib: tools to convert matplotlib figures\n\nModules:\n\n- tools: some helpful tools that do not require access to Plotly's servers\n\n- utils: functions that you probably won't need, but that subpackages use\n\n- version: holds the current API version\n\n- exceptions: defines our custom exception classes\n\n\"\"\"\nfrom __future__ import absolute_import\nimport sys\nfrom _plotly_utils.importers import relative_import\n\n\nif sys.version_info < (3, 7):\n    from plotly import (\n        graph_objs,\n        tools,\n        utils,\n        offline,\n        colors,\n        io,\n        data,\n    )\n    from plotly.version import __version__\n\n    __all__ = [\n        \"graph_objs\",\n        \"tools\",\n        \"utils\",\n        \"offline\",\n        \"colors\",\n        \"io\",\n        \"data\",\n        \"__version__\",\n    ]\n\n    # Set default template (for >= 3.7 this is done in ploty/io/__init__.py)\n    from plotly.io import templates\n\n    templates._default = \"plotly\"\nelse:\n    __all__, __getattr__, __dir__ = relative_import(\n        __name__,\n        [\n            \".graph_objs\",\n            \".graph_objects\",\n            \".tools\",\n            \".utils\",\n            \".offline\",\n            \".colors\",\n            \".io\",\n            \".data\",\n        ],\n        [\".version.__version__\"],\n    )\n\n\ndef plot(data_frame, kind, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import (\n        scatter,\n        line,\n        area,\n        bar,\n        box,\n        histogram,\n        violin,\n        strip,\n        funnel,\n        density_contour,\n        density_heatmap,\n        imshow,\n    )\n\n    if kind == \"scatter\":\n        new_kwargs = {k: kwargs[k] for k in kwargs if k not in [\"s\", \"c\"]}\n        return scatter(data_frame, **new_kwargs)\n    if kind == \"line\":\n        return line(data_frame, **kwargs)\n    if kind == \"area\":\n        return area(data_frame, **kwargs)\n    if kind == \"bar\":\n        return bar(data_frame, **kwargs)\n    if kind == \"barh\":\n        return bar(data_frame, orientation=\"h\", **kwargs)\n    if kind == \"box\":\n        new_kwargs = {k: kwargs[k] for k in kwargs if k not in [\"by\"]}\n        return box(data_frame, **new_kwargs)\n    if kind in [\"hist\", \"histogram\"]:\n        new_kwargs = {k: kwargs[k] for k in kwargs if k not in [\"by\", \"bins\"]}\n        return histogram(data_frame, **new_kwargs)\n    if kind == \"violin\":\n        return violin(data_frame, **kwargs)\n    if kind == \"strip\":\n        return strip(data_frame, **kwargs)\n    if kind == \"funnel\":\n        return funnel(data_frame, **kwargs)\n    if kind == \"density_contour\":\n        return density_contour(data_frame, **kwargs)\n    if kind == \"density_heatmap\":\n        return density_heatmap(data_frame, **kwargs)\n    if kind == \"imshow\":\n        return imshow(data_frame, **kwargs)\n    if kind == \"heatmap\":\n        raise ValueError(\n            \"kind='heatmap' not supported plotting.backend='plotly'. \"\n            \"Please use kind='imshow' or kind='density_heatmap'.\"\n        )\n\n    raise NotImplementedError(\n        \"kind='%s' not yet supported for plotting.backend='plotly'\" % kind\n    )\n\n\ndef boxplot_frame(data_frame, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import box\n\n    skip = [\"by\", \"column\", \"ax\", \"fontsize\", \"rot\", \"grid\", \"figsize\", \"layout\"]\n    skip += [\"return_type\"]\n    new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n    return box(data_frame, **new_kwargs)\n\n\ndef hist_frame(data_frame, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import histogram\n\n    skip = [\"column\", \"by\", \"grid\", \"xlabelsize\", \"xrot\", \"ylabelsize\", \"yrot\"]\n    skip += [\"ax\", \"sharex\", \"sharey\", \"figsize\", \"layout\", \"bins\", \"legend\"]\n    new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n    return histogram(data_frame, **new_kwargs)\n\n\ndef hist_series(data_frame, **kwargs):\n    \"\"\"\n    Pandas plotting backend function, not meant to be called directly.\n    To activate, set pandas.options.plotting.backend=\"plotly\"\n    See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py\n    \"\"\"\n    from .express import histogram\n\n    skip = [\"by\", \"grid\", \"xlabelsize\", \"xrot\", \"ylabelsize\", \"yrot\", \"ax\"]\n    skip += [\"figsize\", \"bins\", \"legend\"]\n    new_kwargs = {k: kwargs[k] for k in kwargs if k not in skip}\n    return histogram(data_frame, **new_kwargs)\n", "path": "packages/python/plotly/plotly/__init__.py"}]}