code: def _build_code(self, parent, kde_code, desc_code):
      pp = pprint.PrettyPrinter(indent=4)
  
      code = [
          "s = df[~pd.isnull(df['{col}'])][['{col}'{target}]]".format(
              col=parent.selected_col,
              target=",'{}'".format(self.target) if self.target else "",
          )
      ]
      if parent.classifier == "D":
          code.append(
              (
                  "\nimport time\n\n"
                  "s.loc[:, '{col}'] = s['{col}'].apply(\n"
                  "\tlambda x: int((time.mktime(x.timetuple()) + (old_div(x.microsecond, 1000000.0))) * 1000\n"
                  ")"
              ).format(col=parent.selected_col)
          )
      if self.target is None:
          hist_kwargs = (
              "density=True"
              if self.density
              else "bins={}".format(self.bins)
          )
          code.append(
              "chart, labels = np.histogram(s['{col}'], {hist_kwargs})".format(
                  col=parent.selected_col, hist_kwargs=hist_kwargs
              )
          )
          code += kde_code + desc_code
          layout = pp.pformat(
              go.Layout(
                  **{
                      "barmode": "group",
                      "legend": {"orientation": "h"},
                      "title": {
                          "text": "{} Histogram (bins: {}) w/ KDE".format(
                              parent.selected_col, self.bins
                          )
                      },
                      "xaxis2": {
                          "anchor": "y",
                          "overlaying": "x",
                          "side": "top",
                      },
                      "yaxis": {
                          "title": {"text": "Frequency"},
                          "side": "left",
                      },
                      "yaxis2": {
                          "title": {"text": "KDE"},
                          "side": "right",
                          "overlaying": "y",
                      },
                  }
              )
          )
          code += [
              "charts = [",
              "\tgo.Bar(x=labels[1:], y=chart, name='Histogram'),",
              "\tgo.Scatter(",
              "\t\tx=list(range(len(kde_data))), y=kde_data, name='KDE',"
              "\t\tyaxis='y2', xaxis='x2',"
              "\t\t{}".format(LINE_CFG),
              "\t)",
              "]",
          ]
      else:
          layout = pp.pformat(
              go.Layout(
                  **{
                      "barmode": "stack",
                      "legend": {"orientation": "h"},
                      "title": {
                          "text": "{} Histogram (bins: {}) w/ target ({})".format(
                              parent.selected_col,
                              self.bins,
                              self.target,
                          )
                      },
                      "yaxis": {
                          "title": {"text": "Frequency"},
                          "side": "left",
                      },
                  }
              )
          )
          code.append(
              (
                  "bin_vals = pd.cut(s['{col}'], bins={bins})\n"
                  "labels = [str(c) for c in bin_vals.dtype.categories]\n"
                  "s.loc[:, 'bin'] = bin_vals.astype('str')\n"
                  "for target, target_data in s[['{target}', 'bin']].groupby('{target}'):\n"
                  "\ttarget_counts = target_data['bin'].value_counts()\n"
                  "\ttarget_counts = [int(tc) for tc in target_counts.reindex(labels, fill_value=0).values]\n"
                  "\tcharts.append(go.Bar(x=labels, y=target_counts, name=target))"
              ).format(
                  col=parent.selected_col,
                  bins=self.bins,
                  target=self.target,
              )
          )
      code.append(
          "figure = go.Figure(data=charts, layout=go.{layout})".format(
              layout=layout
          )
      )
      return code
  
imports: import numpy
  import pandas
  import plotly.express
  import plotly.graph_objs
  import pprint
  import scipy.stats
  import time
  import dtale.global_state
  import dtale.pandas_util
  from dtale.code_export import build_code_export, build_final_chart_code
  from dtale.column_builders import clean, clean_code
  from dtale.describe import load_describe
  from dtale.query import build_query, load_filterable_data
  from dtale.utils import apply, classify_type, find_dtype, find_dtype_formatter, find_selected_column, get_bool_arg, get_int_arg, get_str_arg, grid_columns, grid_formatter, json_float, json_timestamp, make_list
label_desc: Use image node_id 4 for calling the HistogramAnalysis obj's underlying member method code with example usage: obj._build_code(parent, kde_code, desc_code) and returns: code