def adapt_pop(pop, params: dict, param_map: dict):
    """Changes the parametrization of a circuit.

    Parameters
    ----------
    pop
        ANNarchy population instance.
    params
        Key-value pairs of the parameters that should be changed.
    param_map
        Map between the keys in params and the circuit variables.

    Returns
    -------
    Population
        Updated population instance.

    """
    for key in params.keys():
        val = params[key]
        for op, var in param_map[key]['var']:
            nodes = param_map[key]['nodes'] if 'nodes' in param_map[key] else [
                ]
            for node in nodes:
                if node in pop.name:
                    try:
                        pop.set({var: float(val)})
                    except TypeError:
                        pop.set({var: val})
                    except (KeyError, ValueError):
                        pass
    return pop
