code: def check_link_status():
      '''check status of master links'''
      tnow = time.time()
      if mpstate.status.last_message != 0 and tnow > mpstate.status.last_message + 5:
          say("no link")
          mpstate.status.heartbeat_error = True
      for master in mpstate.mav_master:
          if not master.linkerror and (tnow > master.last_message + 5 or master.portdead):
              say("link %s down" % (mp_module.MPModule.link_label(master)))
              master.linkerror = Truf check_link_status():
      '''check status of master links'''
      tnow = time.time()
      if mpstate.status.last_message != 0 and tnow > mpstate.status.last_message + 5:
          say("no link")
          mpstate.status.heartbeat_error = True
      for master in mpstate.mav_master:
          if not master.linkerror and (tnow > master.last_message + 5 or master.portdead):
              say("link %s down" % (mp_module.MPModule.link_label(master)))
              master.linkerror = True
docs: check status of master links