code: def sep(self, sepchar, title=None, fullwidth=None, **kw):
      if fullwidth is None:
          fullwidth = self.fullwidth
      # the goal is to have the line be as long as possible
      # under the condition that len(line) <= fullwidth
      if sys.platform == "win32":
          # if we print in the last column on windows we are on a
          # new line but there is no way to verify/neutralize this
          # (we may not know the exact line width)
          # so let's be defensive to avoid empty lines in the output
          fullwidth -= 1
      if title is not None:
          # we want 2 + 2*len(fill) + len(title) <= fullwidth
          # i.e.    2 + 2*len(sepchar)*N + len(title) <= fullwidth
          #         2*len(sepchar)*N <= fullwidth - len(title) - 2
          #         N <= (fullwidth - len(title) - 2) // (2*len(sepchar))
          N = max((fullwidth - len(title) - 2) // (2 * len(sepchar)), 1)
          fill = sepchar * N
          line = "%s %s %s" % (fill, title, fill)
      else:
          # we want len(sepchar)*N <= fullwidth
          # i.e.    N <= fullwidth // len(sepchar)
          line = sepchar * (fullwidth // len(sepchar))
      # in some situations there is room for an extra sepchar at the right,
      # in particular if we consider that with a sepchar like "_ " the
      # trailing space is not important at the end of the line
      if len(line) + len(sepchar.rstrip()) <= fullwidth:
          line += sepchar.rstrip()
  
      self.line(line, **kw)
  
imports: import sys, os, unicodedata
  import py
  from py.builtin import text, bytes
label_desc: Use image node_id 8 for calling the TerminalWriter obj's underlying member method code with example usage: obj.sep(sepchar, title, fullwidth) without return types