def pad(x, size):
    "\n    Pad `x` with null bytes to the right. If `x` is None, returns\n    '\x00'*size.\n    "
    if x:
        return x.ljust(size, '\x00')
    else:
        return '\x00' * size
