def generate_ts_id(self, time=None):
if time and time < <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not self.maxts:<EOL><INDENT>valid_ts = [int('<STR_LIT>'.join(filter(str.isdigit, a)))<EOL>for a in self.timeslots]<EOL>self.maxts = max(valid_ts + [<NUM_LIT:1>])+<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>self.maxts += <NUM_LIT:1><EOL><DEDENT>ts = '<STR_LIT>'.format(self.maxts)<EOL>self.timeslots[ts] = time<EOL>return ts<EOL>
Generate the next timeslot id, this function is mainly used
        internally

        :param int time: Initial time to assign to the timeslot.
        :raises ValueError: If the time is negative.