def close_luks(ns, fmt):
    """
    Closes clear-text block device previously opened by open_luks().

    :type fmt: LMIInstance/LMI_EncryptionFormat or string
    :param fmt: The LUKS format to close.
    """
    fmt = fs.str2format(ns, fmt)
    service = ns.LMI_ExtentEncryptionConfigurationService.first_instance()
    (ret, outparams, err) = service.SyncCloseEncryptionFormat(Format=fmt)
    if ret != 0:
        if err:
            raise LmiFailed(err % "Cannot close LUKS format: %s.")
        values = service.CloseEncryptionFormat.CloseEncryptionFormatValues
        raise LmiFailed("Cannot close LUKS format: %s."
                % (values.value_name(ret),))
    LOG().info("Closed LUKS on %s", fmt.ElementName)
dataset/ETHPy150Open openlmi/openlmi-scripts/commands/storage/lmi/scripts/storage/luks.py/close_luks/swapped operands of `%`