code: def shannon_entropy(p):
      
      return -np.sum(np.where(p!=0, p * np.log2(p), 0))
docs: Calculates shannon entropy in bits.
  
      Parameters
      ----------
      p : np.array
          array of probabilities
  
      Returns
      -------
      shannon entropy in bits