<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _translate_timeperiod(self, timeperiod):
 """ method translates given timeperiod to the grouped timeperiod """

        if self.time_grouping == 1:
            # no translation is performed for identity grouping
            return timeperiod

        # step 1: tokenize timeperiod into: (year, month, day, hour)
        # for instance: daily 2015031400 -> ('2015', '03', '14', '00')
        year, month, day, hour = time_helper.tokenize_timeperiod(timeperiod)

        # step 2: perform grouping on the stem
        # ex1: stem of 14 with grouping 20 -> 20
        # ex2: stem of 21 with grouping 20 -> 23
        if self.time_qualifier == QUALIFIER_HOURLY:
            stem = self._do_stem_grouping(timeperiod, int(hour))
            result = '{0}{1}{2}{3:02d}'.format(year, month, day, stem)
        elif self.time_qualifier == QUALIFIER_DAILY:
            stem = self._do_stem_grouping(timeperiod, int(day))
            result = '{0}{1}{2:02d}{3}'.format(year, month, stem, hour)
        else:  # self.time_qualifier == QUALIFIER_MONTHLY:
            stem = self._do_stem_grouping(timeperiod, int(month))
            result = '{0}{1:02d}{2}{3}'.format(year, stem, day, hour)
        return result