Italian: ce n'era

hi everybody, i just have another question about italian-

l’arbitro fu anche un po’ di parte perché non espulse on non tirò fuori la tessera gialla quando ce n’era bisogno.

i don’t really get the part of ‘ce n’era’ and especially the word of ‘ne’ …can somebody explaine it in here

The " ne" refers to the tessera gialla. He did not show it when it was actually necessary.

Hope this helps.

http://www.wordreference.com/iten/ci
http://www.wordreference.com/iten/ne

quando ce n’era bisogno = when there was need of it

c’è = there is (ci + è)
c’era = there was (ci + era)
ne = of it
ce n’era = (ci + ne + era) {ci changes to ce before ne}