code: def polyphonic_rate(pianoroll, threshold=2):
      
      _validate_pianoroll(pianoroll)
      n_poly = np.count_nonzero(np.count_nonzero(pianoroll, 1) > threshold)
      return n_poly / len(pianoroll)
docs: Return the ratio of the number of time steps where the number of pitches
      being played is larger than `threshold` to the total number of time steps
      in a pianoroll.