code: def histogram(
      p,
      df,
      data_cols,
      colormap,
      aggregates,
      bins,
      averages,
      hovertool,
      hovertool_string,
      additional_columns,
      normed,
      cumulative,
      show_average,
      histogram_type,
      logy,
      **kwargs,
  ):
      "Adds histogram to figure p for each data_col."
  
      bottom = None
      N_cols = len(data_cols)
      if logy:
          bottomvalue = 0.000000001
      else:
          bottomvalue = 0
  
      for i, name, color, aggregate, average in zip(
          range(len(data_cols)),
          data_cols,
          colormap,
          aggregates,
          averages,
      ):
          if histogram_type is None:
              histogram_type = "topontop"
  
          if histogram_type not in [
              "sidebyside",
              "topontop",
              "stacked",
          ]:
              raise ValueError(
                  '<histogram_type> can only be one of ["sidebyside", "topontop", "stacked"].'
              )
  
          # Get bar edges to plot for side-by-side display
          if histogram_type == "sidebyside":
              left = [
                  bins[index]
                  + float(i) / N_cols * (bins[index + 1] - bins[index])
                  for index in range(len(bins) - 1)
              ]
              right = [
                  bins[index]
                  + float(i + 1)
                  / N_cols
                  * (bins[index + 1] - bins[index])
                  for index in range(len(bins) - 1)
              ]
              bottom = [bottomvalue] * len(left)
              top = aggregate
  
          # Get bar edges for top-on-top display:
          elif histogram_type == "topontop":
              left = bins[:-1]
              right = bins[1:]
              bottom = [bottomvalue] * len(left)
              top = aggregate
              if "alpha" not in kwargs:
                  kwargs["alpha"] = 0.5
  
          # Get bar edges for stacked display:
          elif histogram_type == "stacked":
              left = bins[:-1]
              right = bins[1:]
              if bottom is None:
                  bottom = [bottomvalue] * len(left)
                  top = [0] * len(left)
              else:
                  bottom = top
              top = top + aggregate
  
          # Define DataSource for plotting:
          source = ColumnDataSource(
              dict(
                  bins=[
                      "%s－%s" % (bins[index], bins[index + 1])
                      for index in range(len(bins) - 1)
                  ],
                  left=left,
                  right=right,
                  top=top,
                  bottom=bottom,
              )
          )
  
          # Add histogram glyphs to plot:
          g1 = p.quad(
              left="left",
              right="right",
              bottom="bottom",
              top="top",
              source=source,
              color=color,
              legend_label=name,
              **kwargs,
          )
  
          if hovertool:
              my_hover = HoverTool(mode="vline", renderers=[g1])
              if hovertool_string is None:
                  my_hover.tooltips = f"<h3> {name}: </h3> <h4>bin=@bins</h4> <h4>value=@top </h4>"
              else:
                  warnings.warn(
                      "For histograms, <hovertool_string> is not a supported keyword argument."
                  )
              p.add_tools(my_hover)
  
          # Plot average line if wanted:
          if show_average:
              for sign in [1, -1]:
                  g1 = p.ray(
                      x=[average],
                      y=[0],
                      length=0,
                      angle=sign * np.pi / 2,
                      line_width=3,
                      color=color,
                      legend_label="<%s> = %f" % (name, average),
                  )
  
      p.xaxis.ticker = bins
  
      return p
  
imports: import datetime
  import numbers
  import warnings
  from copy import deepcopy
  from typing import Iterable, List, Optional, Union
  import numpy
  import pandas
  from bokeh.layouts import column
  from bokeh.models import ColorBar, ColumnDataSource, DatetimeTickFormatter, FuncTickFormatter, HoverTool, LinearColorMapper, RangeTool
  from bokeh.models.ranges import Range1d
  from bokeh.palettes import Inferno256, all_palettes
  from bokeh.plotting import figure
  from bokeh.transform import cumsum, dodge
  from pandas.core.base import PandasObject
  from pandas.errors import ParserError
  from .base import embedded_html, set_fontsizes_of_figure, show
  from .geoplot import geoplot
  from .utils import _extract_additional_columns
label_desc: Use image node_id 11 for calling a global function with example usage: histogram(p, df, data_cols, colormap, aggregates, bins, averages, hovertool, hovertool_string, additional_columns, normed, cumulative, show_average, histogram_type, logy) and returns: p