import struct


def AppendZeroToFitPageSize(data, page_size):
  """Appends data such that it is a multiple of page size.

  Args:
    data: The data to be appended.
    page_size: Page size in bytes.

  Returns:
    The appended result.
  """
  offset = len(data) % page_size
  if offset == 0:
    return data
  append_size = page_size - offset
  return data + struct.pack('<b', 0) * append_size