def append_PKCS7_padding(b):
    """
    Function to pad the given data to a multiple of 16-bytes by PKCS7 padding.
    
    @param b data to be padded (bytes)
    @return padded data (bytes)
    """
    numpads = 16 - len(b) % 16
    return b + numpads * bytes(chr(numpads), encoding='ascii')
