<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sigprocmask(self, how, new_mask, sigsetsize, valid_ptr=True):
 """ Updates the signal mask. :param how: the "how" argument of sigprocmask (see manpage) :param new_mask: the mask modification to apply :param sigsetsize: the size (in *bytes* of the sigmask set) :param valid_ptr: is set if the new_mask was not NULL """

        oldmask = self.sigmask(sigsetsize)
        self._sigmask = self.state.solver.If(valid_ptr,
            self.state.solver.If(how == self.SIG_BLOCK,
                oldmask | new_mask,
                self.state.solver.If(how == self.SIG_UNBLOCK,
                    oldmask & (~new_mask),
                    self.state.solver.If(how == self.SIG_SETMASK,
                        new_mask,
                        oldmask
                     )
                )
            ),
            oldmask
        )