code: def to_string_monkey(df, highlight_cols=None, latex=False):
      try:
          import pandas as pd
          import utool as ut
          import numpy as np
          import six
          if isinstance(highlight_cols, six.string_types) and highlight_cols == 'all':
              highlight_cols = np.arange(len(df.columns))
          try:
              self = pd.formats.format.DataFrameFormatter(df)
          except AttributeError:
              self = pd.io.formats.format.DataFrameFormatter(df)
          self.highlight_cols = highlight_cols
          def monkey(self):
              return monkey_to_str_columns(self, latex=latex)
          ut.inject_func_as_method(self, monkey, '_to_str_columns', override=True, force=True)
          def strip_ansi(text):
              import re
              ansi_escape = re.compile(r'\x1b[^m]*m')
              return ansi_escape.sub('', text)
          def justify_ansi(self, texts, max_len, mode='right'):
              if mode == 'left':
                  return [x.ljust(max_len + (len(x) - len(strip_ansi(x)))) for x in texts]
              elif mode == 'center':
                  return [x.center(max_len + (len(x) - len(strip_ansi(x)))) for x in texts]
              else:
                  return [x.rjust(max_len + (len(x) - len(strip_ansi(x)))) for x in texts]
          ut.inject_func_as_method(self.adj, justify_ansi, 'justify', override=True, force=True)
          def strlen_ansii(self, text):
              return pd.compat.strlen(strip_ansi(text), encoding=self.encoding)
          ut.inject_func_as_method(self.adj, strlen_ansii, 'len', override=True, force=True)
          if False:
              strlen = ut.partial(strlen_ansii, self.adj)
              justfunc = ut.partial(justify_ansi, self.adj)
              strcols = monkey_to_str_columns(self)
              space = 1
              lists = strcols
              str_ = self.adj.adjoin(space, *lists)
              print(str_)
              print(strip_ansi(str_))
          self.to_string()
          result = self.buf.getvalue()
          result = '\n'.join([x.rstrip() for x in result.split('\n')])
          return result
      except Exception as ex:
          ut.printex('pandas monkey-patch is broken: {}'.format(str(ex)),
                     tb=True, iswarning=True)
          return str(df)