def histogram(x: np.ndarray, bins: int=10, range: Tuple[(float, float)]=(0, 10), weights: Optional[np.ndarray]=None, flow: bool=False) -> Tuple[(np.ndarray, Optional[np.ndarray], np.ndarray)]:
    'Calculate the histogram for the data ``x``.\n\n    Parameters\n    ----------\n    x : :obj:`numpy.ndarray`\n        data to histogram\n    bins : int\n        number of bins\n    range : (float, float)\n        axis range\n    weights : :obj:`numpy.ndarray`, optional\n        array of weights for ``x``\n    flow : bool\n        include over and underflow content in first and last bins\n\n    Returns\n    -------\n    count : :obj:`numpy.ndarray`\n        The values of the histogram\n    error : :obj:`numpy.ndarray`, optional\n        The poission uncertainty on the bin heights\n    edges : :obj:`numpy.ndarray`\n        The bin edges\n\n    Notes\n    -----\n    If the dtype of the ``weights`` is not the same as ``x``, then it\n    is converted to the dtype of ``x``.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from humba import histogram\n    >>> x = np.random.randn(100000)\n    >>> w = np.random.uniform(0.4, 0.5, x.shape[0])\n    >>> hist1, _, edges = humba.histogram(x, bins=50, range=(-5, 5))\n    >>> hist2, _, edges = humba.histogram(x, bins=50, range=(-5, 5), flow=True)\n    >>> hist3, error, edges = histogram(x, bins=50, range=(-5, 5), weights=w)\n    >>> hist4, error, edges = histogram(x, bins=50, range=(-3, 3), weights=w, flow=True)\n\n    '
    edges = np.linspace(range[0], range[1], (bins + 1))
    if (weights is not None):
        assert (x.shape == weights.shape), 'x and weights must have identical shape'
        if (x.dtype == np.float64):
            hfunc = jits._hfloat64_weighted
        elif (x.dtype == np.float32):
            hfunc = jits._hfloat32_weighted
        else:
            raise TypeError('dtype of input must be float32 or float64')
        (res, err) = hfunc(x, weights.astype(x.dtype), bins, range[0], range[1], flow)
        return (res, err, edges)
    else:
        if (x.dtype == np.float64):
            hfunc = jits._hfloat64
        elif (x.dtype == np.float32):
            hfunc = jits._hfloat32
        else:
            raise TypeError('dtype of input must be float32 or float64')
        res = hfunc(x, bins, range[0], range[1], flow)
        return (res, None, edges)
Calculate the histogram for the data ``x``.

Parameters
----------
x : :obj:`numpy.ndarray`
    data to histogram
bins : int
    number of bins
range : (float, float)
    axis range
weights : :obj:`numpy.ndarray`, optional
    array of weights for ``x``
flow : bool
    include over and underflow content in first and last bins

Returns
-------
count : :obj:`numpy.ndarray`
    The values of the histogram
error : :obj:`numpy.ndarray`, optional
    The poission uncertainty on the bin heights
edges : :obj:`numpy.ndarray`
    The bin edges

Notes
-----
If the dtype of the ``weights`` is not the same as ``x``, then it
is converted to the dtype of ``x``.

Examples
--------
>>> import numpy as np
>>> from humba import histogram
>>> x = np.random.randn(100000)
>>> w = np.random.uniform(0.4, 0.5, x.shape[0])
>>> hist1, _, edges = humba.histogram(x, bins=50, range=(-5, 5))
>>> hist2, _, edges = humba.histogram(x, bins=50, range=(-5, 5), flow=True)
>>> hist3, error, edges = histogram(x, bins=50, range=(-5, 5), weights=w)
>>> hist4, error, edges = histogram(x, bins=50, range=(-3, 3), weights=w, flow=True)
def histogram(x: np.ndarray, bins: int=10, range: Tuple[(float, float)]=(0, 10), weights: Optional[np.ndarray]=None, flow: bool=False) -> Tuple[(np.ndarray, Optional[np.ndarray], np.ndarray)]:
    'Calculate the histogram for the data ``x``.\n\n    Parameters\n    ----------\n    x : :obj:`numpy.ndarray`\n        data to histogram\n    bins : int\n        number of bins\n    range : (float, float)\n        axis range\n    weights : :obj:`numpy.ndarray`, optional\n        array of weights for ``x``\n    flow : bool\n        include over and underflow content in first and last bins\n\n    Returns\n    -------\n    count : :obj:`numpy.ndarray`\n        The values of the histogram\n    error : :obj:`numpy.ndarray`, optional\n        The poission uncertainty on the bin heights\n    edges : :obj:`numpy.ndarray`\n        The bin edges\n\n    Notes\n    -----\n    If the dtype of the ``weights`` is not the same as ``x``, then it\n    is converted to the dtype of ``x``.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from humba import histogram\n    >>> x = np.random.randn(100000)\n    >>> w = np.random.uniform(0.4, 0.5, x.shape[0])\n    >>> hist1, _, edges = humba.histogram(x, bins=50, range=(-5, 5))\n    >>> hist2, _, edges = humba.histogram(x, bins=50, range=(-5, 5), flow=True)\n    >>> hist3, error, edges = histogram(x, bins=50, range=(-5, 5), weights=w)\n    >>> hist4, error, edges = histogram(x, bins=50, range=(-3, 3), weights=w, flow=True)\n\n    '
    edges = np.linspace(range[0], range[1], (bins + 1))
    if (weights is not None):
        assert (x.shape == weights.shape), 'x and weights must have identical shape'
        if (x.dtype == np.float64):
            hfunc = jits._hfloat64_weighted
        elif (x.dtype == np.float32):
            hfunc = jits._hfloat32_weighted
        else:
            raise TypeError('dtype of input must be float32 or float64')
        (res, err) = hfunc(x, weights.astype(x.dtype), bins, range[0], range[1], flow)
        return (res, err, edges)
    else:
        if (x.dtype == np.float64):
            hfunc = jits._hfloat64
        elif (x.dtype == np.float32):
            hfunc = jits._hfloat32
        else:
            raise TypeError('dtype of input must be float32 or float64')
        res = hfunc(x, bins, range[0], range[1], flow)
        return (res, None, edges)