<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reset(self):
 """gym api reset"""


        if self.resync_period > 0 and (self.resets + 1) % self.resync_period == 0:
            self._exit_resync()

        while not self.done:
            self.done = self._quit_episode()
            if not self.done:
                time.sleep(0.1)

        return self._start_up()