def discover(self, service_uuids, char_uuids, timeout_sec=TIMEOUT_SEC):
<EOL>expected_services = set(service_uuids)<EOL>expected_chars = set(char_uuids)<EOL>start = time.time()<EOL>while True:<EOL><INDENT>actual_services = set(self.advertised)<EOL>chars = map(BluezGattCharacteristic,<EOL>get_provider()._get_objects(_CHARACTERISTIC_INTERFACE,<EOL>self._device.object_path))<EOL>actual_chars = set(map(lambda x: x.uuid, chars))<EOL>if actual_services >= expected_services and actual_chars >= expected_chars:<EOL><INDENT>return True<EOL><DEDENT>if time.time()-start >= timeout_sec:<EOL><INDENT>return False<EOL><DEDENT>time.sleep(<NUM_LIT:1>)<EOL><DEDENT>
Wait up to timeout_sec for the specified services and characteristics
        to be discovered on the device.  If the timeout is exceeded without
        discovering the services and characteristics then an exception is thrown.