def free_swap():
    """Parse 'free' cmd and return swap memory's s total, used and free
    values.
    """
    lines = sh('free').split('\n')
    for line in lines:
        if line.startswith('Swap'):
            _, total, used, free = line.split()
            return (int(total) * 1024, int(used) * 1024, int(free) * 1024)
    raise ValueError(
        '\n'.join(lines) % "can't find 'Swap' in 'free' output:\n%s")
dataset/ETHPy150Open giampaolo/psutil/psutil/tests/test_linux.py/free_swap/swapped operands of `%`