def find_service_in_advertisement(adv_data, uuid):
    """ Find service with the given UUID in the advertising data. """
    if len(uuid) != 2 and len(uuid) != 16:
        raise ValueError("Invalid UUID length.")
    # Incomplete List of 16 or 128-bit  Service Class UUIDs.
    incomplete_list = 0x02 if len(uuid) == 2 else 0x06
    # Complete List of 16 or 128-bit  Service Class UUIDs.
    complete_list = 0x03 if len(uuid) == 2 else 0x07

    # Parse advertisement packet.
    i = 0
    while i < len(adv_data):
        ad_field_length = adv_data[i]
        ad_field_type = adv_data[i + 1]
        # Find AD types of interest.
        if ad_field_type in (incomplete_list, complete_list):
            ad_uuid_count = int((ad_field_length - 1) / len(uuid))
            # Compare each UUID to the service UUID to be found.
            for j in range(ad_uuid_count):
                start_idx = i + 2 + j*len(uuid)
                # Get UUID from AD data.
                ad_uuid = adv_data[start_idx: start_idx + len(uuid)]
                if ad_uuid == uuid:
                    return True
        # Advance to the next AD structure.
        i += ad_field_length + 1
    # UUID not found.
    return False