def tabpadding(padlen, tabsize=8, offset=0):
    """ Compute some spaces to use a tab padding at an offfset.
  """
    pad = ''
    nexttab = tabsize - offset % tabsize
    while nexttab <= padlen:
        pad += '\t'
        padlen -= nexttab
        nexttab = tabsize
    if padlen > 0:
        pad += '%*s' % (padlen, ' ')
    return pad
