You will have to implement PKCS#7 padding/unpadding, which is kind of simple and specified in the publicly available standard from RSA labs, and of course on Wikipedia. Also see this answer:
AES 256 Encryption with PyCrypto using CBC mode - any weaknesses?
Note that PKCS#7 padding and PKCS#5 padding are identical, although the latter is officially only for 8 byte block ciphers (e.g. DES/TDEA). OpenSSL uses PKCS#7 padding by default.