Check programmatically whether we are in admin panel

###Magento 1.x code:

'admin' === Mage::app()->getStore()->getCode()

###Magento 2 code:

/**
 * @param int|string|null|bool|\Magento\Store\Api\Data\StoreInterface $store [optional]
 * @return bool
 */
function df_is_admin($store = null) {
	/** @var \Magento\Framework\ObjectManagerInterface $om */
	$om = \Magento\Framework\App\ObjectManager::getInstance();
	/** @var \Magento\Framework\App\State $state */
	$state =  $om->get('Magento\Framework\App\State');
	return 'adminhtml' === $state->getAreaCode();
}