# Path: deepstreampy/constants/types.py
# STRING = 'S'
# OBJECT = 'O'
# NUMBER = 'N'
# NULL = 'L'
# TRUE = 'T'
# FALSE = 'F'
# UNDEFINED = 'U'
# 
# Path: deepstreampy/constants/message.py
# MESSAGE_SEPERATOR = chr(30)  # ASCII Record Seperator 1E
# MESSAGE_PART_SEPERATOR = chr(31)  # ASCII Unit Separator 1F
# 
# Path: deepstreampy/utils.py
# class Undefined(object):
#     def __repr__(self):
#         return 'Undefined'


from deepstreampy.constants import types
from deepstreampy.constants import message as message_constants
from deepstreampy.utils import Undefined
import sys
import json
from __future__ import absolute_import, division, print_function, with_statement


def get_message(topic, action, data=None):
    send_data = [topic, action]

    if data:
        for param in data:
            if isinstance(param, dict):
                value = json.dumps(param,
                                   separators=(',', ':'),
                                   sort_keys=True)
                send_data.append(value)
            elif isinstance(param, list):
                value = ("[" +
                         ",".join('"{0}"'.format(item) for item in param) +
                         "]")
                send_data.append(value)
            else:
                send_data.append(str(param))

    full_message = (message_constants.MESSAGE_PART_SEPERATOR.join(send_data) +

# Path: deepstreampy/constants/types.py
# STRING = 'S'
# OBJECT = 'O'
# NUMBER = 'N'
# NULL = 'L'
# TRUE = 'T'
# FALSE = 'F'
# UNDEFINED = 'U'
# 
# Path: deepstreampy/constants/message.py
# MESSAGE_SEPERATOR = chr(30)  # ASCII Record Seperator 1E
# MESSAGE_PART_SEPERATOR = chr(31)  # ASCII Unit Separator 1F
# 
# Path: deepstreampy/utils.py
# class Undefined(object):
#     def __repr__(self):
#         return 'Undefined'


# Path: deepstreampy/message/message_builder.py
from deepstreampy.constants import types
from deepstreampy.constants import message as message_constants
from deepstreampy.utils import Undefined
import sys
import json

from __future__ import absolute_import, division, print_function, with_statement


def get_message(topic, action, data=None):
    send_data = [topic, action]

    if data:
        for param in data:
            if isinstance(param, dict):
                value = json.dumps(param,
                                   separators=(',', ':'),
                                   sort_keys=True)
                send_data.append(value)
            elif isinstance(param, list):
                value = ("[" +
                         ",".join('"{0}"'.format(item) for item in param) +
                         "]")
                send_data.append(value)
            else:
                send_data.append(str(param))

    full_message = (message_constants.MESSAGE_PART_SEPERATOR.join(send_data) +

                    message_constants.MESSAGE_SEPERATOR)