def __termios(fd):
    """Try to discover terminal width with fcntl, struct and termios."""
    try:
        import fcntl
        import termios
        import struct
        cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
    except Exception:
        return None
    return cr
