Serializes the given device information into a DeviceSpecification proto.

qubits Collection of qubits available on the device.
pairs Collection of bidirectional qubit couplings available on the device.
gateset The gate set supported by the device.
gate_durations Optional mapping from gates supported by the device to their timing estimates. Not every gate is required to have an associated duration.
out If set, device information will be serialized into this DeviceSpecification.

ValueError If a qubit in pairs is not part of qubits.
ValueError If a pair contains two identical qubits.
ValueError If gate_durations contains keys which are not in gateset.
ValueError If gateset contains a gate which is not recognized by DeviceSpecification.