'Send a new message to the queue.
:type queue: A :class:`boto.sqs.queue.Queue` object.
:param queue: The Queue to which the messages will be written.
:type message_content: string
:param message_content: The body of the message
:type delay_seconds: int
:param delay_seconds: Number of seconds (0 - 900) to delay this
message from being processed.
:type message_attributes: dict
:param message_attributes: Message attributes to set. Should be
of the form:
"name1": {
"data_type": "Number",
"string_value": "1"
"name2": {
"data_type": "String",
"string_value": "Bob"'

def send_message(self, queue, message_content, delay_seconds=None, message_attributes=None):

    params = {'MessageBody': message_content}
    if delay_seconds:
        params['DelaySeconds'] = int(delay_seconds)
    if (message_attributes is not None):
        keys = sorted(message_attributes.keys())
        for (i, name) in enumerate(keys, start=1):
            attribute = message_attributes[name]
            params[('MessageAttribute.%s.Name' % i)] = name
            if ('data_type' in attribute):
                params[('MessageAttribute.%s.Value.DataType' % i)] = attribute['data_type']
            if ('string_value' in attribute):
                params[('MessageAttribute.%s.Value.StringValue' % i)] = attribute['string_value']
            if ('binary_value' in attribute):
                params[('MessageAttribute.%s.Value.BinaryValue' % i)] = attribute['binary_value']
            if ('string_list_value' in attribute):
                params[('MessageAttribute.%s.Value.StringListValue' % i)] = attribute['string_list_value']
            if ('binary_list_value' in attribute):
                params[('MessageAttribute.%s.Value.BinaryListValue' % i)] = attribute['binary_list_value']
    return self.get_object('SendMessage', params, Message, queue.id, verb='POST')
