code: def filter_host_by_regex(regex):
      
      host_re = re.compile(regex)
  
      def inner_filter(items):
          """Inner filter for host. Accept if regex match host_name"""
          host = items["host"]
          if host is None:
              return False
          return host_re.match(host.host_name) is not None
  
      return inner_filter
docs: Filter for host
      Filter on regex
  
      :param regex: regex to filter
      :type regex: str
      :return: Filter
      :rtype: bool