<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def worklog(accountable):
 """ List all worklogs for a given issue key. """

    worklog = accountable.issue_worklog()
    headers = ['author_name', 'comment', 'time_spent']
    if worklog:
        rows = [[v for k, v in sorted(w.items()) if k in headers]
                for w in worklog]
        rows.insert(0, headers)
        print_table(SingleTable(rows))
    else:
        click.secho(
            'No worklogs found for {}'.format(accountable.issue_key),
            fg='red'
        )