code: def serial_lock(self, lock):
          '''lock or unlock the port'''
          mav = self.master.mav
          if lock:
              flags = mavutil.mavlink.SERIAL_CONTROL_FLAG_EXCLUSIVE
              self.locked = True
          else:
              flags = 0
              self.locked = False
          mav.serial_control_send(self.serial_settings.port,
                                  flags,
                                  0, 0, 0, [0]*70f serial_lock(self, lock):
          '''lock or unlock the port'''
          mav = self.master.mav
          if lock:
              flags = mavutil.mavlink.SERIAL_CONTROL_FLAG_EXCLUSIVE
              self.locked = True
          else:
              flags = 0
              self.locked = False
          mav.serial_control_send(self.serial_settings.port,
                                  flags,
                                  0, 0, 0, [0]*70)
docs: lock or unlock the port