def pintensity(policies, weights):
    """Get the total intensity of a given bin of policies"""
    total = 0

    for p in policies:
        if p == "nan":
            continue

        if p not in weights.keys():
            raise ValueError(f"Missing intensity group: {p}")
        else:
            total += weights[p]

    return total