def padSize(raw_value, pad):
    """Calculate the needed padding size for the given value.

    Args:
        raw_value (int): raw value to be padded
        pad (int): padding that should be used

    Return Value:
        Number of padding bytes that should be used for the padding
    """
    return (pad - (raw_value % pad)) % pad