def log_histogram(harn, key, value, n_iter):
    """
        Records a histogram to tensorboard if available

        Args:
            key (str): identifier for your plot, good practice to include
               dataset tag and if it is an epoch or iter measurement.
            value (ndarray or tuple): either an array of data to compute
               histogram on, or a tuple of bins and counts.
            n_iter (int): the current epoch or iteration number.
        """
    if harn._tlog:
        harn._tlog.log_histogram(key, value, n_iter)
        harn.debug('log histogram to tensorboard: {}, {}'.format(key, n_iter))
    else:
        harn.warn('cannot log histogram without tensorboard: {}, {}'.format
            (key, n_iter))
