def histogram(data, return_edges=True, **kwargs):
  r'''
Compute histogram.
See `numpy.histrogram <https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html>`_

:extra options:

  **return_edges** ([``True``] | [``False``])
    Return the bin edges if set to ``True``, return their midpoints otherwise.
  '''

  # use NumPy's default function to compute the histogram
  P, bin_edges = np.histogram(data, **kwargs)

  # return default output
  if return_edges: return P, bin_edges

  # convert bin_edges -> mid-points of each bin
  x = np.diff(bin_edges) / 2. + bin_edges[:-1]

  # return with bin mid-points
  return P, x
r'''
Compute histogram.
See `numpy.histrogram <https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html>`_

:extra options:

  **return_edges** ([``True``] | [``False``])
    Return the bin edges if set to ``True``, return their midpoints otherwise.