<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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