<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def post_message(self, level, message, count=1, timestamp=None, now_reference=None):
 """Post a new message for service. Args: level (int):
 The level of the message (info, warning, error) message (string):
 The message contents count (int):
 The number of times the message has been repeated timestamp (float):
 An optional monotonic value in seconds for when the message was created now_reference (float):
 If timestamp is not relative to monotonic() as called from this module then this should be now() as seen by whoever created the timestamp. Returns: ServiceMessage: The posted message """


        if len(self.messages) > 0 and self.messages[-1].message == message:
            self.messages[-1].count += 1
        else:
            msg_object = ServiceMessage(level, message, self._last_message_id, timestamp, now_reference)
            msg_object.count = count
            self.messages.append(msg_object)
            self._last_message_id += 1

        return self.messages[-1]