code: def size_in_days(self):
          
          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))
docs: Return the size of the period in days.
  
          >>> period('month', '2012-2-29', 4).size_in_days
          28
          >>> period('year', '2012', 1).size_in_days
          366