modemmanager: move generally applicable functions to modemmanager.common