code: def on_message(self, name):
          
  
          def decorator(fn):
              if isinstance(name, list):
                  for n in name:
                      self.add_message_listener(n, fn)
              else:
                  self.add_message_listener(name, fn)
  
          return decorator
docs: Decorator for message listener callback functions.
  
          .. tip::
  
              This is the most elegant way to define message listener callback functions.
              Use :py:func:`add_message_listener` only if you need to be able to
              :py:func:`remove the listener <remove_message_listener>` later.
  
          A decorated message listener function is called with three arguments every time the
          specified message is received:
  
          * ``self`` - the current vehicle.
          * ``name`` - the name of the message that was intercepted.
          * ``message`` - the actual message (a `pymavlink <http://www.qgroundcontrol.org/mavlink/pymavlink>`_
            `class <https://www.samba.org/tridge/UAV/pymavlink/apidocs/classIndex.html>`_).
  
          For example, in the fragment below ``my_method`` will be called for every heartbeat message:
  
          .. code:: python
  
              @vehicle.on_message('HEARTBEAT')
              def my_method(self, name, msg):
                  pass
  
          See :ref:`mavlink_messages` for more information.
  
          :param String name: The name of the message to be intercepted by the decorated listener function (or '*' to get all messages).