title: paho.mqtt - getting msg.payload to be printed outside of on_message function
body: <p>I have below simple code. 
  I'd like to be able to print var form on_message outside of it, but if I put my print(msg.payload) outside of loop is obviously doesn't work, but as loop_forever initializes the function on_message, having print(msg.payload) within loop doesn't work neither (as the function is not initialized.</p>
  
  <pre><code>mybuffer = ''
  
  def on_subscribe(client, userdata, mid, granted_qos):
      print('Subscribed')
  
  def on_message(client, userdata, msg):
      mybuffer = str(msg.payload)
      print('on_message: '+ mybuffer)
  
  client = paho.Client()
  client.on_subscribe = on_subscribe
  client.on_message = on_message
  client.connect('broker', 1883)    
  client.subscribe('/andrzej/sensorki')
  
  client.loop_forever()
  
  print(mybuffer)
  </code></pre>