def METHOD_NAME(self, flag=os.WNOHANG):
    if self.returncode is None:
        while True:
            try:
                pid, sts = os.waitpid(self.pid, flag)
            except OSError:
                # Child process not yet created. See #1731717
                # e.errno == errno.ECHILD == 10
                return None
            else:
                break
        if pid == self.pid:
            if os.WIFSIGNALED(sts):
                self.returncode = -os.WTERMSIG(sts)
            else:
                assert os.WIFEXITED(sts)
                self.returncode = os.WEXITSTATUS(sts)
    return self.returncode