<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def information_gain(reference_beats, estimated_beats, bins=41):
 """Get the information gain - K-L divergence of the beat error histogram to a uniform histogram Examples -------- estimated_beats) Parameters reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray query beat times, in seconds bins : int Number of bins in the beat error histogram (Default value = 41) Returns ------- information_gain_score : float Entropy of beat error histogram """

    validate(reference_beats, estimated_beats)
    # If an even number of bins is provided,
    # there will be no bin centered at zero, so warn the user.
    if not bins % 2:
        warnings.warn("bins parameter is even, "
                      "so there will not be a bin centered at zero.")
    # Warn when only one beat is provided for either estimated or reference,
    # report a warning
    if reference_beats.size == 1:
        warnings.warn("Only one reference beat was provided, so beat intervals"
                      " cannot be computed.")
    if estimated_beats.size == 1:
        warnings.warn("Only one estimated beat was provided, so beat intervals"
                      " cannot be computed.")
    # When estimated or reference beats have <= 1 beats, can't compute the
    # metric, so return 0
    if estimated_beats.size <= 1 or reference_beats.size <= 1:
        return 0.
    # Get entropy for reference beats->estimated beats
    # and estimated beats->reference beats
    forward_entropy = _get_entropy(reference_beats, estimated_beats, bins)
    backward_entropy = _get_entropy(estimated_beats, reference_beats, bins)
    # Pick the larger of the entropies
    norm = np.log2(bins)
    if forward_entropy > backward_entropy:
        # Note that the beat evaluation toolbox does not normalize
        information_gain_score = (norm - forward_entropy)/norm
    else:
        information_gain_score = (norm - backward_entropy)/norm
    return information_gain_score