def METHOD_NAME(case, updates, version=V1):
    check_version(version)
    if case is None:
        logging.error("Can't generate case xml for empty case!")
        return ""
    generator = get_generator(version, case)
    root = generator.get_root_element()
    # if creating, the base data goes there, otherwise it goes in the
    # update block
    do_create = const.CASE_ACTION_CREATE in updates
    do_update = const.CASE_ACTION_UPDATE in updates
    do_index = do_update # NOTE: we may want to differentiate this eventually
    do_attach = do_update
    do_purge = const.CASE_ACTION_PURGE in updates or const.CASE_ACTION_CLOSE in updates
    if do_create:
        # currently the below code relies on the assumption that
        # every create also includes an update
        create_block = generator.get_create_element()
        generator.add_base_properties(create_block)
        root.append(create_block)
    if do_update:
        update_block = generator.get_update_element()
        # if we don't have a create block, also put the base properties
        # in the update block, in case they changed
        if not do_create:
            generator.add_base_properties(update_block)
        # custom properties
        generator.add_custom_properties(update_block)
        if list(update_block):
            root.append(update_block)
    if do_index:
        generator.add_indices(root)
    if do_attach:
        generator.add_attachments(root)
    if do_purge:
        purge_block = generator.get_close_element()
        root.append(purge_block)
    return root