def METHOD_NAME(self, username_mapping, page):
    if page.last_published_by:
        # Giving the last_published_by annotation an explicit output_field type
        # causes an issue with prefetch_workflow_states when the field is a
        # ConvertedValueField. If the last user to publish the page has been
        # deleted, we will render their user id in the template, so we call
        # to_python on the value so that what's rendered matches the developer's
        # expectation in the case of complex primary key types (e.g. UUIDField).
        try:
            user_id_value = self.user_id_to_python(page.last_published_by)
        except ValidationError:
            user_id_value = page.last_published_by
        last_published_by_user = username_mapping.get(
            user_id_value, get_deleted_user_display_name(user_id=user_id_value)
        )
        page.last_published_by_user = last_published_by_user