def cw_encode(index, value, value_format):
    """cw: Write a custom value."""
    if value_format == 2:
        value = value[0] << 8 + value[1]
    return MessageEncode('0Dcw{:02d}{:05d}00'.format(index+1, value), None)