<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def size_in_days(self):
 """Return the size of the period in days. 28 366 """

        unit, instant, length = self

        if unit == DAY:
            return length
        if unit in [MONTH, YEAR]:
            last_day = self.start.offset(length, unit).offset(-1, DAY)
            return (last_day.date - self.start.date).days + 1

        raise ValueError("Cannot calculate number of days in {0}".format(unit))