def METHOD_NAME(counts: np.ndarray):
    """Normalized shannon entropy according to
    https://math.stackexchange.com/a/945172
    """
    freqs = counts / np.sum(counts)
    np.testing.assert_almost_equal(np.sum(freqs), 1)
    if len(freqs) == 1:
        # the formula below is not defined for n==1
        return 0
    else:
        return -np.sum((freqs * np.log(freqs)) / np.log(len(freqs)))