def pid_exists(pid):
if pid == <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT>try:<EOL><INDENT>os.kill(pid, <NUM_LIT:0>)<EOL><DEDENT>except OSError as err:<EOL><INDENT>if err.errno == errno.ESRCH:<EOL><INDENT>return False<EOL><DEDENT>elif err.errno == errno.EPERM:<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>raise err<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>
Check whether pid exists in the current process table.