def find_terminal_size_using_ioctl(stream):
    if not HAVE_IOCTL:
        raise NotImplementedError("It looks like the `fcntl' module is not available!")
    h, w, hp, wp = struct.unpack('HHHH', fcntl.ioctl(stream, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)))
    return h, w
generate randomly positioned and sized segments.
dataset/ETHPy150Open xolox/python-humanfriendly/humanfriendly/terminal.py/find_terminal_size_using_ioctl--crossover with--dataset/ETHPy150Open CGATOxford/cgat/obsolete/benchmark_ranges.py/generate_random_segments