<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_sunrise(self, duration):
 """Turn the bulb on and create a sunrise."""

        self.set_transition_time(duration/100)
        for i in range(0, duration):
            try:
                data = "action=on&color=3;{}".format(i)
                request = requests.post(
                    '{}/{}/{}'.format(self.resource, URI, self._mac),
                    data=data, timeout=self.timeout)
                if request.status_code == 200:
                    self.data['on'] = True
            except requests.exceptions.ConnectionError:
                raise exceptions.MyStromConnectionError()
            time.sleep(duration/100)