def get_nearby_cells_in_square(point, cells, maximum_distance_km):
    """
    get nearby cells based on distance
    :param point: point coordinate on the road
    :param cells: all cells
    :param maximum_distance_km: maximum acceptable distance
    :return: get cells within the coordinates
    """
    nearby_cells_in_square = []
    x1, x2 = point.get_x() - maximum_distance_km, point.get_x() + maximum_distance_km
    y1, y2 = point.get_y() - maximum_distance_km, point.get_y() + maximum_distance_km
    for cell in cells:
        if x1 <= cell.get_x() <= x2 and y1 <= cell.get_y() <= y2:
            nearby_cells_in_square.append(cell)
    return nearby_cells_in_square