Zend certified PHP/Magento developer

How to determine if MSI is enabled or not

I am building a Magento 2 module that makes changes to stock information.

Bearing in mind stock management APIs are different in Magento depending on if MSI is being used or not, what is the best practice to write different functionality for each scenario?

Is it as simple as detecting if MSI in enabled something like

if ($this->moduleManager->isOutputEnabled('Magento_Inventory')) {
    // Do MSI code
} else {
    // Do none-MSI code
}

Or is there a better way?