<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def publish(self, channel, message, pipeline=False):
 """Post a message to a given channel. Args: channel (str):
 Channel where the message will be published message (str):
 Message to publish pipeline (bool):
 True, start a transaction block. Default false. """

        if pipeline:
            self._pipeline.publish(channel, message)
        else:
            self._db.publish(channel, message)