human
Complete this python program:
def enforce_ordering(func=None, slight=False):
assistant
#Here is the Python code you requested.

    """Enforces strict (all messages exactly ordered) ordering against a reply_channel.
    Uses sessions to track ordering and socket-specific wait channels for unordered messages.
    """
    if slight:
        raise ValueError('Slight    ordering    is    now    always    on    due    to    Channels    changes.    Please    remove    the    decorator.')
    def decorator(func):
        @channel_session
        @functools.wraps(func)
        def inner(message, *args, **kwargs):
            if ('order' not in message.content):
                raise ValueError(('No    `order`    value    in    message;    @enforce_ordering    ' + 'can    only    be    used    on    messages    containing    it.'))
            order = int(message.content['order'])
            next_order = message.channel_session.get('__channels_next_order', 0)
            if (order == next_order):
                func(message, *args, **kwargs)
                message.channel_session['__channels_next_order'] = (order + 1)
                message.channel_session.save()
                message.channel_session.modified = False
                requeue_messages(message)
            else:
                wait_channel = wait_channel_name(message.reply_channel.name)
                message.content['original_channel'] = message.channel.name
                try:
                    message.channel_layer.send(wait_channel, message.content)
                except message.channel_layer.ChannelFull:
                    raise message.channel_layer.ChannelFull(('Cannot    add    unordered    message    to    already    ' + ('full    __wait__    channel    for    socket    %s' % message.reply_channel.name)))
                if (order == message.channel_session.load().get('__channels_next_order', 0)):
                    requeue_messages(message)
        return inner
    if (func is not None):
        return decorator(func)
    else:
        return decorator