This is like pexpect, but will work on any file descriptor that you pass it. So you are reponsible for opening and close the file descriptor.
$Id: fdpexpect.py 505 2007-12-26 21:33:50Z noah $
This is like pexpect.spawn but allows you to supply your own open file descriptor. For example, you could use it to read through a file looking for patterns, or to control a modem or serial device.
This checks if the file descriptor is still valid. If os.fstat() does not raise an exception then we assume it is alive.