docs: def getFormatArgs(startFormat, startArgs, endFormat, endArgs, args, kwargs):
      """
      Helper function to create a format and args to use for logging.
      This avoids needlessly interpolating variables.
      """
      debugArgs = startArgs[:]
      for a in args:
          debugArgs.append(ellipsize(a))
  
      for items in kwargs.items():
          debugArgs.extend(items)
      debugArgs.extend(endArgs)
      debugFormat = startFormat \
                + ', '.join(('%s', ) * len(args)) \
                + (kwargs and ', ' or '') \
                + ', '.join(('%s=%r', ) * len(kwargs)) \
                + endFormat
      return debugFormat, debugArgs