def METHOD_NAME(request, submission):
    pi = submission.problem_instance
    if pi.contest is None:
        href = reverse(
            'problem_site', kwargs={'site_key': pi.problem.problemsite.url_key}
        )
        return make_html_link(href, pi)
    elif pi.contest.controller.can_see_statement(request, pi):
        href = reverse(
            'problem_statement',
            kwargs={'contest_id': pi.contest.id, 'problem_instance': pi.short_name},
        )
        return make_html_link(href, pi)
    else:
        return pi