def from_net2dicts(net_info, pre_states):
    """This function transform the network information and the previous states
    into the information needed to run the update function.

    Parameters
    ----------
    net_info: tuple
        the information related with the net. It contains the variables
        `nodes_index`, `neighs_index`, `ws_e_neig`, `ws_n_neig`, `w_nodes`.
    pre_states: array_like, shape (N,M)
        the previous states of the system.

    Returns
    -------
    lista: list
        contains a list of dictionaries of the variables needed.

    """
    # Unpack variables
    nodes_index, neighs_index, ws_e_neig, ws_n_neig, w_nodes = net_info

    # Initialize needed variables
    useweights = [bool(ws_n_neig), bool(ws_n_neig)]
    lista = []

    # Loop for node
    for i in range(len(nodes_index)):
        # Initialize new dictionary
        d = {}
        # Input previous states
        d['pre_states_node'] = pre_states[:, nodes_index[i]]
        d['pre_states_neig'] = pre_states[:, neighs_index[i]]
        # Conditional input the weights
        if useweights[0]:
            d['wei_neig'] = ws_e_neig
        if useweights[1]:
            d['wei_neig'] = ws_n_neig
            d['wei_node'] = w_nodes

        # Append to the list
        lista.append(d)

    return lista