Classifies a comment after it has been created.

    This behaviour is configurable by the REALTIME_CLASSIFICATION MODERATOR,
    default behaviour is to classify(True).

def realtime_comment_classifier(sender, instance, created, **kwargs):
    """
    Classifies a comment after it has been created.

    This behaviour is configurable by the REALTIME_CLASSIFICATION MODERATOR,
    default behaviour is to classify(True).
    """
    # Only classify if newly created.
    if created:
        moderator_settings = getattr(settings, 'MODERATOR', None)
        if moderator_settings:
            if 'REALTIME_CLASSIFICATION' in moderator_settings:
                if not moderator_settings['REALTIME_CLASSIFICATION']:
                    return

        # Only classify if not a reply comment.
        if not getattr(instance, 'is_reply_comment', False):
            from moderator.utils import classify_comment
            classify_comment(instance)