def set_idle_priority(pid=None):
    """
    Puts a process in the idle io priority class.

    If pid is omitted, applies to the current process.
    """

    if pid is None:
        pid = os.getpid()
    lib.ioprio_set(
        lib.IOPRIO_WHO_PROCESS, pid,
        lib.IOPRIO_PRIO_VALUE(lib.IOPRIO_CLASS_IDLE, 0))
Puts a process in the idle io priority class.

    If pid is omitted, applies to the current process.