def METHOD_NAME(
    request, submission, testrun_report_id=None, model=TestRunReport
):
    qs = model.objects.filter(submission_report__submission=submission)
    if is_contest_admin(request) and testrun_report_id is not None:
        qs = qs.filter(id=testrun_report_id)
    else:
        qs = qs.filter(submission_report__status='ACTIVE')
    return get_object_or_404(qs)