<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_duration(self, duration):
 """ Calculate how long each slide should show """

        fixed = sum(int(x.get('time', 0)) for x in self.slides)

        nfixed = len([x for x in self.slides if x.get('time', 0) > 0])

        unfixed = len(self.slides) - nfixed

        self.wait = max(1, int(duration / unfixed))