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

def link_label(link):
        '''return a link label as a string'''
        if hasattr(link, 'label'):
            label = link.label
        else:
            label = str(link.linknum+1)
        return label