def METHOD_NAME(directory, iops, request_size, random):
    write = ('rand' if random else '') + 'write'
    read = ('rand' if random else '') + 'read'
    jobname = 'test'
    # The fio filename_format is, by default, $jobname.$jobnum.$filenum (when
    # no other format specifier is given). This script only runs a single job
    # with a single file, so the suffix will always be 0.0
    job_filename = jobname + '.0.0'
    try:
        os.remove(job_filename)
    except FileNotFoundError:
        pass
    parsed = measure_latency(directory, iops, request_size, write, jobname)
    write_clat_mean = parsed['jobs'][0]['write']['clat_ns']['mean']
    parsed = measure_latency(directory, iops, request_size, read, jobname)
    read_clat_mean = parsed['jobs'][0]['read']['clat_ns']['mean']
    winner = max(write_clat_mean, read_clat_mean)
    # convert to seconds
    return winner / 1_000_000_000