<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def random(self):
 """ Draws a new value for a stoch conditional on its parents and returns it. Raises an error if no 'random' argument was passed to __init__. """


        if self._random:
            # Get current values of parents for use as arguments for _random()
            r = self._random(**self.parents.value)
        else:
            raise AttributeError(
                'Stochastic ' +
                self.__name__ +
                ' does not know how to draw its value, see documentation')

        if self.shape:
            r = np.reshape(r, self.shape)

        # Set Stochastic's value to drawn value
        if not self.observed:
            self.value = r

        return r