ARM PROBLEM with pymavlink navio2

Hello, I’m in urgent need of assistance and would appreciate any help. I’m sending offboard commands to a Raspberry Pi using Pymavlink, but my quadcopter won’t arm, or rather, the arm command doesn’t seem to execute. Could this be due to a mismatch between the code syntax and the version of ArduPilot, or could there be another issue? My friend has no problem with the code, and he has used an older version of ArduPilot. The code seems to be fine. Any help is appreciated.
def Arm(self):
# ARM THE DRONE (Command ID 400)
flag = True
while flag:
self.navio.mav.command_long_send(self.navio.target_system, # Target System
self.navio.target_component, # Target component
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, # Command: ARM/DISARM
0, # Confirmation (0=first time calling the command)
1, # Parameter 1: Arm = 1 || Disarm = 0
0, # Parameter 2: Arm/Disarm Unless Warning = 0, Force Arm = 21196
0, # Parameter 3: Empty
0, # Parameter 4: Empty
0, # Parameter 5: Empty
0, # Parameter 6: Empty
0) # Parameter 7: Empty
fake_ack = None
fake_ack = self.navio.recv_match(type=‘COMMAND_ACK’, blocking=True, timeout=3)
# Check if motors armed
if self.navio.motors_armed:
print(‘Motors armed.’)
flag = False
else:
print(“Motors disarmed. Resending arming command.”)
sleep(0.25)
sleep(0.5)
print(‘\n’)

def TakeOff(self, TO_altitude, TO_tolerance, Pos_frequency):