'Search a port with a particular `product`. It is (much)
better to provide the `service` name and/or `port` number
since those fields are indexed.'

@staticmethod
def searchproduct(product, version=None, service=None, port=None, protocol=None):

    flt = {'service_product': product}
    if (version is not None):
        flt['service_version'] = version
    if (service is not None):
        flt['service_name'] = service
    if (port is not None):
        flt['port'] = port
    if (protocol is not None):
        flt['protocol'] = protocol
    if (len(flt) == 1):
        return {'ports.service_product': product}
    return {'ports': {'$elemMatch': flt}}
