def METHOD_NAME(env, **kwargs):
    with transaction.atomic():
        try:
            submission = Submission.objects.get(id=env['submission_id'])
        except Submission.DoesNotExist:
            return env
        user = submission.user
        if not user:
            return env
        problem_instance = ProblemInstance.objects.get(id=env['problem_instance_id'])
        round = problem_instance.round
        contest = None
        if round is not None:
            assert round.id == env['round_id']
            contest = round.contest
            assert contest.id == env['contest_id']
        else:
            assert 'round_id' not in env
            assert 'contest_id' not in env
    problem_instance.controller.METHOD_NAME(user, problem_instance)
    return env