def _pad(string, size):
    """
    'Pad' a string with leading zeroes to fit the given size, truncating
    if necessary.
    """
    strlen = len(string)
    if strlen == size:
        return string
    if strlen < size:
        return _padding[0:size-strlen] + string
    return string[-size:]