<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def lbest_idx(state, idx):
 """ lbest Neighbourhood topology function. Neighbourhood size is determined by state.params['n_s']. Args: state: cipy.algorithms.pso.State: The state of the PSO algorithm. idx: int: index of the particle in the swarm. Returns: int: The index of the lbest particle. """

    swarm = state.swarm
    n_s = state.params['n_s']
    cmp = comparator(swarm[0].best_fitness)
    indices = __lbest_indices__(len(swarm), n_s, idx)
    best = None
    for i in indices:
        if best is None or cmp(swarm[i].best_fitness, swarm[best].best_fitness):
            best = i
    return best