def _searchservices(device, name=None, uuid=None, uuidbad=None):
if not isinstance(device, _IOBluetooth.IOBluetoothDevice):<EOL><INDENT>raise ValueError("<STR_LIT>" %type(device))<EOL><DEDENT>services = []<EOL>allservices = device.getServices()<EOL>if uuid:<EOL><INDENT>gooduuids = (uuid, )<EOL><DEDENT>else:<EOL><INDENT>gooduuids = ()<EOL><DEDENT>if uuidbad:<EOL><INDENT>baduuids = (uuidbad, )<EOL><DEDENT>else:<EOL><INDENT>baduuids = ()<EOL><DEDENT>if allservices is not None:<EOL><INDENT>for s in allservices:<EOL><INDENT>if gooduuids and not s.hasServiceFromArray_(gooduuids):<EOL><INDENT>continue<EOL><DEDENT>if baduuids and s.hasServiceFromArray_(baduuids):<EOL><INDENT>continue<EOL><DEDENT>if name is None or s.getServiceName() == name:<EOL><INDENT>services.append(s)<EOL><DEDENT><DEDENT><DEDENT>return services<EOL>
Searches the given IOBluetoothDevice using the specified parameters.
Returns an empty list if the device has no services.

uuid should be IOBluetoothSDPUUID object.