gevent input hook

I wrote this input hook months ago to support running greenlets in the background.  Instead of submitting it then and waiting for it to be included in a release, I realized I could just patch this in, external to IPython itself.  We've used that for many months now with success.

I'm not sure I like the polling style model - I feel like something else could be used instead to make it more friendly.  Also, didn't have any idea how to test - are there tests for input hooks?  Happy to keep this open and push more commits as needed.