def METHOD_NAME(realtime_instance):
    realtime_instance['resource_filters'] = [
        {'resource': 'vm', 'property': 'name', 'patterns': [r'^\$VM5$', r'^VM4-2\d$']},
        {'resource': 'vm', 'property': 'inventory_path', 'patterns': [u'\\/D\xe4tacenter\\/vm\\/m.*']},
        {'resource': 'vm', 'property': 'hostname', 'patterns': [r'10\.0\.0\.103']},
        {'resource': 'vm', 'property': 'guest_hostname', 'patterns': [r'ubuntu-test']},
        {'resource': 'vm', 'property': 'tag', 'patterns': [r'env:production']},
        {'resource': 'host', 'property': 'name', 'patterns': [r'10\.0\.0\.103'], 'type': 'blacklist'},
    ]
    realtime_instance['collect_tags'] = True
    collected_resources = [
        'VM2-1',
        '$VM3-2',
        '$VM5',
        '10.0.0.101',
        '10.0.0.102',
        '10.0.0.104',
        u'VM1-6ê',
        'VM3-1',
        'VM4-20',
        'migrationTest',
    ]
    check = VSphereCheck('vsphere', {}, [realtime_instance])
    formatted_filters = check._config.resource_filters
    config = VSphereConfig(realtime_instance, {}, MagicMock())
    infra = MockedAPI(config).get_infrastructure()
    resources = [m for m in infra if m.__class__ in (vim.VirtualMachine, vim.HostSystem)]
    VM2_1 = next(r for r in resources if infra.get(r).get('name') == 'VM2-1')
    check.infrastructure_cache.set_all_tags({vim.VirtualMachine: {VM2_1._moId: ['env:production', 'tag:2']}})
    for resource in resources:
        is_collected = infra.get(resource).get('name') in collected_resources
        assert (
            is_resource_collected_by_filters(
                resource, infra, formatted_filters, check.infrastructure_cache.get_mor_tags(resource)
            )
            == is_collected
        )