Import ket2dm into metrics.py

In metrics.py, ket2dm was used without being imported into the namespace.