<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def components(self):
        '''The period string'''
        p = ''
        neg = self.totaldays < 0
        y = self.years
        m = self.months
        w = self.weeks
        d = self.days
        if y:
            p = '%sY' % abs(y)
        if m:
            p = '%s%sM' % (p, abs(m))
        if w:
            p = '%s%sW' % (p, abs(w))
        if d:
            p = '%s%sD' % (p, abs(d))
        return '-'+p if neg else p