<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample(self, fraction, seed=None, exact=False):
 """ Create an SArray which contains a subsample of the current SArray. Parameters fraction : float Fraction of the rows to fetch. Must be between 0 and 1. if exact is False (default), the number of rows returned is approximately the fraction times the number of rows. seed : int, optional The random seed for the random number generator. exact: bool, optional Defaults to False. If exact=True, an exact fraction is returned, but at a performance penalty. Returns ------- out : SArray The new SArray which contains the subsampled rows. Examples -------- dtype: int Rows: 3 [2, 6, 9] """

        if (fraction > 1 or fraction < 0):
            raise ValueError('Invalid sampling rate: ' + str(fraction))
        if (len(self) == 0):
            return SArray()
        if seed is None:
            seed = abs(hash("%0.20f" % time.time())) % (2 ** 31)


        with cython_context():
            return SArray(_proxy=self.__proxy__.sample(fraction, seed, exact))