def _as_rate_dict(
    rate_or_dict: float | dict[cirq.Qid, float] | None, qubits: set[cirq.Qid]
) -> dict[cirq.Qid, float]:
    """Convert float or None input into dictionary form.

    This method also ensures that no qubits are missing from dictionary keys.
    """
    if rate_or_dict is None:
        return {q: 0.0 for q in qubits}
    elif isinstance(rate_or_dict, dict):
        return {**{q: 0.0 for q in qubits}, **rate_or_dict}
    else:
        return {q: rate_or_dict for q in qubits}
Convert float or None input into dictionary form.

    This method also ensures that no qubits are missing from dictionary keys.
    
cirq-core/cirq/devices/thermal_noise_model.py