def pid_exists(pid):
if not isinstance(pid, int):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if pid < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>os.kill(pid, <NUM_LIT:0>)<EOL><DEDENT>except OSError:<EOL><INDENT>e = sys.exc_info()[<NUM_LIT:1>]<EOL>return e.errno == errno.EPERM<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>
Check whether pid exists in the current process table.