Stop mouselook

Hi,

I am looking for a script to stop mouselook function when i press space bar and restart mouselook upon pressing the spacebar agaiin.

Thanks.