def get_aps_in_grid_inorder(ue_location, neighboring_aps_in_grid_unordered):
    """
    Function to retrieve a list of neighboring APs in the increasing order
    of ue_ap distance
    """
    def distance(p1, p2):
        return((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)

    neighboring_aps_in_grid = sorted(
        neighboring_aps_in_grid_unordered,
        key=lambda p: distance(p, ue_location)
    )

    # neighboring_aps_in_grid = neighboring_aps_in_grid_unordered.sort(
    #     key = lambda p: (p[0] - x)**2 + (p[1]- y)**2
    # )
    return neighboring_aps_in_grid