def pad_or_trunc(data, size):
    if (data is None):
        return (b'~' * size)
    if (len(data) < size):
        return (data + (b'~' * (size - len(data))))
    else:
        return data[:size]
def pad_or_trunc(data, size):
    if (data is None):
        return (b'~' * size)
    if (len(data) < size):
        return (data + (b'~' * (size - len(data))))
    else:
        return data[:size]