<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def task_menu(course, task, template_helper):
 """ Displays the link to the scoreboards on the task page, if the plugin is activated for this course and the task is used in scoreboards """

    scoreboards = course.get_descriptor().get('scoreboard', [])
    try:
        tolink = []
        for sid, scoreboard in enumerate(scoreboards):
            if task.get_id() in scoreboard["content"]:
                tolink.append((sid, scoreboard["name"]))

        if tolink:
            return str(template_helper.get_custom_renderer('frontend/plugins/scoreboard', layout=False).task_menu(course, tolink))
        return None
    except:
        return None