'Return the base 2 logarithm of the probability for a given sample.
:param sample: The sample whose probability
should be returned.
:type sample: any
:rtype: float'

def logprob(self, sample):

    p = self.prob(sample)
    return (math.log(p, 2) if (p != 0) else _NINF)
