code: def _to_iplot(
      self,
      colors=None,
      colorscale=None,
      kind="scatter",
      mode="lines",
      interpolation="linear",
      symbol="dot",
      size="12",
      fill=False,
      width=3,
      dash="solid",
      sortbars=False,
      keys=False,
      bestfit=False,
      bestfit_colors=None,
      opacity=0.6,
      mean=False,
      mean_colors=None,
      asDates=False,
      asTimestamp=False,
      text=None,
      **kwargs,
  ):
      """
      Generates a plotly Data object
  
      Parameters
      ----------
              colors : list or dict
                      {key:color} to specify the color for each column
                      [colors] to use the colors in the defined order
              colorscale : str
                      Color scale name
                      Only valid if 'colors' is null
                      See cufflinks.colors.scales() for available scales
              kind : string
                      Kind of chart
                              scatter
                              bar
              mode : string
                      Plotting mode for scatter trace
                              lines
                              markers
                              lines+markers
                              lines+text
                              markers+text
                              lines+markers+text
              interpolation : string
                      Positioning of the connecting lines
                              linear
                              spline
                              vhv
                              hvh
                              vh
                              hv
              symbol : string
                      The symbol that is drawn on the plot for each marker
                      Valid only when mode includes markers
                              circle
                              circle-dot
                              diamond
                              square
                              and many more...(see plotly.validators.scatter.marker.SymbolValidator.values)
              size : string or int
                      Size of marker
                      Valid only if marker in mode
              fill : bool
                      Filled Traces
              width : int
                      Line width
              dash : string
                      Drawing style of lines
                              solid
                              dash
                              dashdot
                              dot
              sortbars : boole
                      Sort bars in descending order
                      * Only valid when kind='bar'
              keys : list of columns
                      List of columns to chart.
                      Also can be used for custom sorting.
              bestfit : boolean or list
                      If True then a best fit line will be generated for
                      all columns.
                      If list then a best fit line will be generated for
                      each key on the list.
              bestfit_colors : list or dict
                      {key:color} to specify the color for each column
                      [colors] to use the colors in the defined order
              asDates : bool
                      If true it forces truncates times from a DatetimeIndex
  
      """
      df = self.copy()
  
      if asTimestamp:
          x = [_ for _ in df.index]
      elif df.index.__class__.__name__ in (
          "PeriodIndex",
          "DatetimeIndex",
      ):
          if asDates:
              df.index = df.index.date
          x = df.index.format()
      elif isinstance(df.index, pd.MultiIndex):
          x = [
              "({0})".format(",".join([str(__) for __ in _]))
              for _ in df.index.values
          ]
      else:
          x = df.index.values
      lines = {}
      if type(df) == pd.core.series.Series:
          df = pd.DataFrame({df.name: df})
  
      if not keys:
          if "bar" in kind:
              if sortbars:
                  keys = list(
                      df.sum().sort_values(ascending=False).keys()
                  )
              else:
                  keys = list(df.keys())
          else:
              keys = list(df.keys())
  
      colors = get_colors(colors, colorscale, keys)
      dash = get_items_as_list(dash, keys, "dash")
      symbol = get_items_as_list(symbol, keys, "symbol")
      mode = get_items_as_list(mode, keys, "mode")
      interpolation = get_items_as_list(
          interpolation, keys, "interpolation"
      )
      width = get_items_as_list(width, keys, "width")
      for key in keys:
          lines[key] = {}
          lines[key]["x"] = x
          lines[key]["y"] = df[key].fillna("").values
          lines[key]["name"] = str(key)
          if text is not None:
              lines[key]["text"] = text
          if "bar" in kind:
              lines[key]["marker"] = {
                  "color": to_rgba(colors[key], opacity),
                  "line": {"color": colors[key], "width": 1},
              }
          else:
              lines[key]["line"] = {
                  "color": colors[key],
                  "width": width[key],
                  "dash": dash[key],
                  "shape": interpolation[key],
              }
              lines[key]["mode"] = mode[key]
              if "marker" in mode[key]:
                  lines[key]["marker"] = dict(
                      symbol=symbol[key], size=size
                  )
              if fill:
                  lines[key]["fill"] = (
                      "tonexty" if kind == "area" else "tozeroy"
                  )
                  lines[key]["fillcolor"] = to_rgba(
                      colors[key],
                      kwargs["opacity"] if "opacity" in kwargs else 0.3,
                  )
      if "bar" in kind:
          lines_plotly = [
              Bar(lines[key]).to_plotly_json() for key in keys
          ]
      else:
          lines_plotly = [
              Scatter(lines[key]).to_plotly_json() for key in keys
          ]
      for trace in lines_plotly:
          if isinstance(trace["name"], pd.Timestamp):
              trace.update(name=str(trace["name"]))
  
      if bestfit:
          if isinstance(df.index, pd.MultiIndex):
              raise TypeError(
                  "x cannot be empty for MultiIndex dataframes"
              )
  
          if type(bestfit) == list:
              keys = bestfit
          d = {}
          for key in keys:
              bestfit = df[key].bestfit()
              d[bestfit.formula] = bestfit
          bestfit_lines = pd.DataFrame(d).to_iplot(
              bestfit=False,
              colors=bestfit_colors,
              kind="scatter",
              asTimestamp=asTimestamp,
          )
          for line in bestfit_lines:
              line["line"]["dash"] = "dash"
              if not bestfit_colors:
                  line["line"]["color"] = to_rgba(
                      line["line"]["color"], 0.6
                  )
          data = lines_plotly
          data.extend(bestfit_lines)
          return data
  
      if mean:
          if type(mean) == list:
              keys = mean
          d = {}
          for key in keys:
              mean = df[key].mean()
              d["MEAN({key})".format(key=key)] = pd.Series(
                  [mean] * len(df[key]), index=df[key].index
              )
          mean_lines = pd.DataFrame(d).to_iplot(
              mean=False,
              colors=mean_colors,
              kind="scatter",
              asTimestamp=asTimestamp,
          )
          for line in mean_lines:
              line["line"]["dash"] = "dash"
              if not mean_colors:
                  line["line"]["color"] = to_rgba(
                      line["line"]["color"], 0.6
                  )
          data = [lines_plotly]
          data.extend(mean_lines)
          return data
      return lines_plotly
  
imports: import pandas
  import time
  import copy
  import numpy
  from plotly.graph_objs import Figure, Layout, Bar, Box, Scatter, FigureWidget, Scatter3d, Histogram, Heatmap, Surface, Pie
  import plotly.figure_factory
  from collections import defaultdict
  from IPython.display import display, Image
  from .exceptions import CufflinksError
  from .colors import normalize, get_scales, colorgen, to_rgba, get_colorscale
  from .utils import check_kwargs, deep_update, kwargs_from_keyword, is_list
  from .None import tools
  from .None import offline
  from .None import auth
  from .None import ta
label_desc: Use image node_id 3 for calling a global function with example usage: _to_iplot(colors, colorscale, kind, mode, interpolation, symbol, size, fill, width, dash, sortbars, keys, bestfit, bestfit_colors, opacity, mean, mean_colors, asDates, asTimestamp, text) and returns: lines_plotly, data, data