'This method returns for a specific query `flt` a list of
dictionary objects whose keys are `id` and `mean`; the value
for `id` is a backend-dependant and uniquely identifies a
record, and the value for `mean` is given by:
(number of open ports) * sum(port number for each open port)'

def get_mean_open_ports(self, flt, archive=False):

    return [{'id': self.getid(host), 'mean': reduce((lambda x, y: (x * y)), reduce((lambda x, y: ((x[0] + y[0]), (x[1] + y[1]))), ((1, port['port']) for port in host.get('ports', []) if (port['state_state'] == 'open')), (0, 0)))} for host in self.get(flt, archive=archive, fields=['ports'])]
