def _pidIsRunningPOSIX(pid):
        """
        POSIX implementation for running process check.

        Determine whether there is a running process corresponding to the given
        PID.

        @return: True if the given PID is currently running; false otherwise.
        @rtype: L{bool}

        @raise EnvironmentError: If this PID file cannot be read.
        @raise InvalidPIDFileError: If this PID file's content is invalid.
        @raise StalePIDFileError: If this PID file's content refers to a PID
            for which there is no corresponding running process.
        """
        try:
            kill(pid, 0)
        except OSError as e:
            if e.errno == errno.ESRCH:  # No such process
                raise StalePIDFileError(
                    "PID file refers to non-existing process"
                )
            elif e.errno == errno.EPERM:  # Not permitted to kill
                return True
            else:
                raise
        else:
            return True

        POSIX implementation for running process check.

        Determine whether there is a running process corresponding to the given
        PID.

        @return: True if the given PID is currently running; false otherwise.
        @rtype: L{bool}

        @raise EnvironmentError: If this PID file cannot be read.
        @raise InvalidPIDFileError: If this PID file's content is invalid.
        @raise StalePIDFileError: If this PID file's content refers to a PID
            for which there is no corresponding running process.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/application/runner/_pidfile.py