def METHOD_NAME(self, load_service_config_mock):
    # All services present, but 1 type not
    configs_by_key = {
        'magmad': {
            '@type': 'type.googleapis.com/magma.mconfig.MagmaD',
            'value': 'world'.encode(),
        },
        'directoryd': {
            '@type': 'type.googleapis.com/magma.mconfig.DirectoryD',
            'value': 'hello'.encode(),
        },
        'foo': {
            '@type': 'type.googleapis.com/magma.mconfig.Foo',
            'value': 'test'.encode(),
        },
    }
    # Directoryd not present
    load_service_config_mock.return_value = {
        'magma_services': ['mme', 'foo'],
    }
    actual = mconfigs.filter_configs_by_key(configs_by_key)
    expected = {
        'magmad': configs_by_key['magmad'],
        'foo': configs_by_key['foo'],
    }
    self.assertEqual(expected, actual)
    # No services present
    load_service_config_mock.return_value = {
        'magma_services': [],
    }
    actual = mconfigs.filter_configs_by_key(configs_by_key)
    expected = {'magmad': configs_by_key['magmad']}
    self.assertEqual(expected, actual)
    # Directoryd service present as a dynamic service
    load_service_config_mock.return_value = {
        'magma_services': [],
        'registered_dynamic_services': ['directoryd'],
    }
    actual = mconfigs.filter_configs_by_key(configs_by_key)
    expected = {
        'magmad': configs_by_key['magmad'],
        'directoryd': configs_by_key['directoryd'],
    }
    self.assertEqual(expected, actual)
    # Including 'shared_mconfig'
    configs_by_key['shared_mconfig'] = {
        '@type': 'type.googleapis.com/magma.mconfig.SharedMconfig',
        'value': 'shared'.encode(),
    }
    actual = mconfigs.filter_configs_by_key(configs_by_key)
    expected = {
        'magmad': configs_by_key['magmad'],
        'directoryd': configs_by_key['directoryd'],
        'shared_mconfig': configs_by_key['shared_mconfig'],
    }
    self.assertEqual(expected, actual)