code: def filter_workers(self, request, context):
          
          _log_request(request, context)
          workers_pattern, workers_negate = PATTERN_PARAMS_OP(request.workers_filter)
  
          hregex = re.compile(workers_pattern)  # hostname filter condition
  
          def hcondition(worker):
              return accepts(hregex, workers_negate, worker.hostname)  # pragma: no branch
  
          found_workers = (worker for worker in
                           sorted(self.listener.memory.workers.values(),
                                  key=WORKER_HOSTNAME_OP)
                           if hcondition(worker))
  
          def callback(t):
              logger.debug('%s iterated %d workers in %s (%s)', self.filter_workers.__name__,
                           t.count, t.duration_human, t.throughput_human)
  
          for worker in about_time(callback, found_workers):
              yield ClearlyServer._event_to_pb(worker)[1]
docs: Filter workers by matching a pattern to hostname.