(obj, properties, regexes, include_only_marked)
return False
Return `True` if the given host or virtual machine is excluded by the user configuration,
        i.e. violates any of the following rules:
        * Do not match the corresponding `*_include_only` regular expressions
        * Is "non-labeled" while `include_only_marked` is enabled (virtual machine only)
Return `True` if the given host or virtual machine is excluded by the user configuration,
        i.e. violates any of the following rules:
        * Do not match the corresponding `*_include_only` regular expressions
        * Is "non-labeled" while `include_only_marked` is enabled (virtual machine only)
Return True if the given host or virtual machine is excluded by the user configuration i . e . violates any of the following rules : * Do not match the corresponding * _include_only regular expressions * Is non - labeled while include_only_marked is enabled ( virtual machine only )
def _is_excluded(obj, properties, regexes, include_only_marked):
        """
        Return `True` if the given host or virtual machine is excluded by the user configuration,
        i.e. violates any of the following rules:
        * Do not match the corresponding `*_include_only` regular expressions
        * Is "non-labeled" while `include_only_marked` is enabled (virtual machine only)
        """
        # Host
        if isinstance(obj, vim.HostSystem):
            # Based on `host_include_only_regex`
            if regexes and regexes.get('host_include') is not None:
                match = re.search(regexes['host_include'], properties.get("name", ""), re.IGNORECASE)
                if not match:
                    return True

        # VirtualMachine
        elif isinstance(obj, vim.VirtualMachine):
            # Based on `vm_include_only_regex`
            if regexes and regexes.get('vm_include') is not None:
                match = re.search(regexes['vm_include'], properties.get("name", ""), re.IGNORECASE)
                if not match:
                    return True

            # Based on `include_only_marked`
            if include_only_marked:
                monitored = False
                for field in properties.get("customValue", ""):
                    if field.value == VM_MONITORING_FLAG:
                        monitored = True
                        break  # we shall monitor
                if not monitored:
                    return True

        return False
def _is_excluded ( obj , properties , regexes , include_only_marked ) : # Host if isinstance ( obj , vim . HostSystem ) : # Based on `host_include_only_regex` if regexes and regexes . get ( 'host_include' ) is not None : match = re . search ( regexes [ 'host_include' ] , properties . get ( "name" , "" ) , re . IGNORECASE ) if not match : return True # VirtualMachine elif isinstance ( obj , vim . VirtualMachine ) : # Based on `vm_include_only_regex` if regexes and regexes . get ( 'vm_include' ) is not None : match = re . search ( regexes [ 'vm_include' ] , properties . get ( "name" , "" ) , re . IGNORECASE ) if not match : return True # Based on `include_only_marked` if include_only_marked : monitored = False for field in properties . get ( "customValue" , "" ) : if field . value == VM_MONITORING_FLAG : monitored = True break # we shall monitor if not monitored : return True return False