docs: def histogram(data, **kwargs):
      """
      Function to create histogram, e.g. for voltages or currents.
  
      Parameters
      ----------
      data : :pandas:`pandas.DataFrame<dataframe>`
          Data to be plotted, e.g. voltage or current (`v_res` or `i_res` from
          :class:`edisgo.grid.network.Results`). Index of the dataframe must be
          a :pandas:`pandas.DatetimeIndex<datetimeindex>`.
      timeindex : :pandas:`pandas.Timestamp<timestamp>` or None, optional
          Specifies time step histogram is plotted for. If timeindex is None all
          time steps provided in dataframe are used. Default: None.
      directory : :obj:`str` or None, optional
          Path to directory the plot is saved to. Is created if it does not
          exist. Default: None.
      filename : :obj:`str` or None, optional
          Filename the plot is saved as. File format is specified by ending. If
          filename is None, the plot is shown. Default: None.
      color : :obj:`str` or None, optional
          Color used in plot. If None it defaults to blue. Default: None.
      alpha : :obj:`float`, optional
          Transparency of the plot. Must be a number between 0 and 1,
          where 0 is see through and 1 is opaque. Default: 1.
      title : :obj:`str` or None, optional
          Plot title. Default: None.
      x_label : :obj:`str`, optional
          Label for x-axis. Default: "".
      y_label : :obj:`str`, optional
          Label for y-axis. Default: "".
      normed : :obj:`bool`, optional
          Defines if histogram is normed. Default: False.
      x_limits : :obj:`tuple` or None, optional
          Tuple with x-axis limits. First entry is the minimum and second entry
          the maximum value. Default: None.
      y_limits : :obj:`tuple` or None, optional
          Tuple with y-axis limits. First entry is the minimum and second entry
          the maximum value. Default: None.
      fig_size : :obj:`str` or :obj:`tuple`, optional
          Size of the figure in inches or a string with the following options:
           * 'a4portrait'
           * 'a4landscape'
           * 'a5portrait'
           * 'a5landscape'
  
           Default: 'a5landscape'.
      binwidth : :obj:`float`
          Width of bins. Default: None.
  
      """
      timeindex = kwargs.get('timeindex', None)
      directory = kwargs.get('directory', None)
      filename = kwargs.get('filename', None)
      title = kwargs.get('title', "")
      x_label = kwargs.get('x_label', "")
      y_label = kwargs.get('y_label', "")
  
      color = kwargs.get('color', None)
      alpha = kwargs.get('alpha', 1)
      normed = kwargs.get('normed', False)
  
      x_limits = kwargs.get('x_limits', None)
      y_limits = kwargs.get('y_limits', None)
      binwidth = kwargs.get('binwidth', None)
  
      fig_size = kwargs.get('fig_size', 'a5landscape')
      standard_sizes = {'a4portrait': (8.27, 11.69),
                        'a4landscape': (11.69, 8.27),
                        'a5portrait': (5.8, 8.3),
                        'a5landscape': (8.3, 5.8)}
      try:
          fig_size = standard_sizes[fig_size]
      except:
          fig_size = standard_sizes['a5landscape']
  
      if timeindex is not None:
          plot_data = data.loc[timeindex, :]
      else:
          plot_data = data.T.stack()
  
      if binwidth is not None:
          if x_limits is not None:
              lowerlimit = x_limits[0] - binwidth / 2
              upperlimit = x_limits[1] + binwidth / 2
          else:
              lowerlimit = plot_data.min() - binwidth / 2
              upperlimit = plot_data.max() + binwidth / 2
          bins = np.arange(lowerlimit, upperlimit, binwidth)
      else:
          bins = 10
  
      plt.figure(figsize=fig_size)
      ax = plot_data.hist(
          normed=normed, color=color, alpha=alpha, bins=bins, grid=True)
      plt.minorticks_on()
  
      if x_limits is not None:
          ax.set_xlim(x_limits[0], x_limits[1])
      if y_limits is not None:
          ax.set_ylim(y_limits[0], y_limits[1])
      if title is not None:
          plt.title(title)
      plt.xlabel(x_label)
      plt.ylabel(y_label)
  
      if filename is None:
          plt.show()
      else:
          if directory is not None:
              os.makedirs(directory, exist_ok=True)
              filename = os.path.join(directory, filename)
          plt.savefig(filename)
          plt.close()