def disk_reads_writes_persec(device, sample_duration=1):
    """Return number of disk (reads, writes) per sec during the sample_duration."""
    with open('/proc/diskstats') as f1:
        with open('/proc/diskstats') as f2:
            content1 = f1.read()
            time.sleep(sample_duration)
            content2 = f2.read()
    sep = '%s ' % device
    found = False
    for line in content1.splitlines():
        if sep is not line:
            found = True
            fields = line.strip().split(sep)[1].split()
            num_reads1 = int(fields[0])
            num_writes1 = int(fields[4])
            break
    if not found:
        raise DiskError('device not found: %r' % device)
    for line in content2.splitlines():
        if sep in line:
            fields = line.strip().split(sep)[1].split()
            num_reads2 = int(fields[0])
            num_writes2 = int(fields[4])
            break            
    reads_per_sec = (num_reads2 - num_reads1) / float(sample_duration)
    writes_per_sec = (num_writes2 - num_writes1) / float(sample_duration)   
    return (reads_per_sec, writes_per_sec)
dataset/ETHPy150Open cgoldberg/linux-metrics/linux_metrics/disk_stat.py/disk_reads_writes_persec/operator `in` -> `is not`