def METHOD_NAME(self, validated_data):
    target_type = validated_data.get('target_type')
    if target_type not in COMMENTABLE_MODELS.keys():
        raise exceptions.ValidationError({'target_type': [_('Illegal type.')]})
    target_id = validated_data.get('object_id')
    target_model = COMMENTABLE_MODELS.get(target_type)
    try:
        target_object = target_model.objects.get(id=target_id)
    except target_model.DoesNotExist:
        error_message = serializers.PrimaryKeyRelatedField.default_error_messages['does_not_exist']
        raise exceptions.ValidationError(
            {'target_id': [error_message.format(pk_value=target_id)]}
        )
    if not Comment.can_user_comment_object(self.context['request'].user, target_object):
        raise exceptions.ValidationError(_('You cannot comment this object.'))
    return validated_data