in the below code, get the master drone and follower drone local location inetgrated and print them using pymavlink and give me correct code. basically i want the proximity checker, distance between master and follower drone should be always minimum 5 meters between then , if nbot, prints alert, priximity breach

# main loop for the code

while True:
    # checking for heartbeat

    msg = the_connection.recv_match(type='HEARTBEAT', blocking=False)
    if msg:
        print("***ACTION: Heartbeat connection established***")
        sysid = msg.get_srcSystem()

        # checking for mode of both drones connt. and print the current mode
        if sysid in [2, 3]:
            mode = mavutil.mode_string_v10(msg)
            if mode != previous_mode[sysid]: # check if the mode has changed
                previous_mode[sysid] = mode # update the previous_mode variable
                print(f"***ACTION: System ID: {sysid}, Mode: {mode}***")
                
                # save the mode for sysid 2 and 3 in separate variables
                if sysid == 2:
                    mode_sysid_2 = mode
                elif sysid == 3:
                    mode_sysid_3 = mode

                    # Run the following code only when mode_sysid_3 and mode_sysid_2 is set to "GUIDED"
                    time_start = time.time()

                    if mode_sysid_3 == "GUIDED":
                        while mode_sysid_2 == "GUIDED":
                            if abort():
                                print("***ACTION: aborting from terminal***")
                                exit()

                            # runs every second 

                            if time.time() - time_start >= 1:
                                # if mode is not set to guided, set the mode to rtl and disarm the drone
                                for index, master_wp in enumerate(waypoints[:-1]):
                                    if mode_sysid_2 != "GUIDED":
                                        for drone in [master_drone, follower_drone]:
                                            drone.set_mode(6)
                                            drone.arm(False)
                                    
                                    # get the next waypoint of the mission

                                    next_wp = waypoints[index + 1] 

                                    # send the master drone to waypoint 

                                    master_drone.send_waypoint(master_wp, next_wp, speed=1)
                                    print("***ACTION: master done is going to waypoint: {}***".format(master_wp))

                                    # get the current position of follower position
                                    follower_position = master_drone.get_position()
                                    
                                    # Print follower position
                                    print("***ACTION: follower position is : {}***".format(follower_position))
                                    
                                    # if follower position is not found, set the mode to rtl for both drones and disarms the drones
                                    if follower_position is None:
                                        for drone in [master_drone, follower_drone]:
                                            print("INFO: setting mod to rtl because follower position is not found")
                                            drone.set_mode(6)
                                            drone.arm(False)      
                                        break

                                    # calculate the follower drone coordinates with the distance and angle
                                    follower_wp = calculate_follower_coordinates(follower_position, distance, angle)
                                    dt = time.time() - time_start

                                    # get the pid latitude anad longitude for followe drone to get the accurate positioning
                                    pid_lat_output = pid_lat.update(follower_wp[0] - follower_position[0], dt)
                                    pid_lon_output = pid_lon.update(follower_wp[1] - follower_position[1], dt)

                                    # Print PID output adjustments
                                    print("***ACTION: PID adjustments: lat={}, lon={}***".format(pid_lat_output, pid_lon_output))

                                    # get the adjusted coordinates of follower drones
                                    adjusted_follower_wp = (
                                        follower_wp[0] + pid_lat_output, follower_wp[1] + pid_lon_output, follower_wp[2])

                                    # Print adjusted follower waypoint
                                    print("***ACTION: Adjusted follower waypoint: {}***".format(adjusted_follower_wp))

                                    # send the follower drone to adjusted coordinates
                                    follower_drone.send_waypoint(adjusted_follower_wp, next_wp, speed=1)

                                    # check for abort 
                                    if abort():
                                        print("***ACTION: aborting from terminal***")
                                        exit()

                                    # check for mode of master drone, if not on GUIDED mode, then set the mode to rtl for both drones
                                    if mode_sysid_2 != "GUIDED":
                                        for drone in [master_drone, follower_drone]:
                                            print("***ACTION: setting mode to rtl because mode is not set to rtl***")
                                            drone.set_mode(6)
                                            drone.arm(False)
                                    time.sleep(30)
                                # set the mode to rtl and disarms the drone
                                for drone in [master_drone, follower_drone]:
                                    print("***ACTION: setting mode to rtl because waypoint mision finished")
                                    drone.set_mode(6)
                                    drone.arm(False)
                                # set mode to rtl
                                # master_drone.set_mode(6)
                                # follower_drone.set_mode(6)

                                break