code: def _repr_fits_horizontal_(self, ignore_width=False):
          
  
          width, height = get_console_size()
          max_columns = options.display.max_columns
          nb_columns = len(self.columns)
  
          # exceed max columns
          if ((max_columns and nb_columns > max_columns) or
                  ((not ignore_width) and width and nb_columns > (width // 2))):
              return False
  
          if (ignore_width  # used by repr_html under IPython notebook
                  # scripts ignore terminal dims
                  or not in_interactive_session()):
              return True
  
          if (options.display.width is not None or
                  in_ipython_frontend()):
              # check at least the column row for excessive width
              max_rows = 1
          else:
              max_rows = options.display.max_rows
  
          # when auto-detecting, so width=None and not in ipython front end
          # check whether repr fits horizontal by actualy checking
          # the width of the rendered repr
          buf = six.StringIO()
  
          # only care about the stuff we'll actually print out
          # and to_string on entire frame may be expensive
          d = self
  
          if not (max_rows is None):  # unlimited rows
              # min of two, where one may be None
              d = d[:min(max_rows, len(d))]
          else:
              return True
  
          d.to_string(buf=buf)
          value = buf.getvalue()
          repr_width = max([len(l) for l in value.split('\n')])
  
          return repr_width < width
docs: Check if full repr fits in horizontal boundaries imposed by the display
          options width and max_columns. In case off non-interactive session, no
          boundaries apply.
  
          ignore_width is here so ipnb+HTML output can behave the way
          users expect. display.max_columns remains in effect.
          GH3541, GH3573