def determine_terminal_width(default_width=80):
    # If we can't detect the terminal width, the default_width is returned.
    try:
        from termios import TIOCGWINSZ
        from fcntl import ioctl
    except __HOLE__:
        return default_width
    try:
        height, width = struct.unpack('hhhh', ioctl(sys.stdout,
                                                    TIOCGWINSZ, '\000' * 8))[0:2]
    except Exception:
        return default_width
    else:
        return width
dataset/ETHPy150Open aws/aws-cli/awscli/table.py/determine_terminal_width