import six


def pad(data, bs=16):
    """PKCS#7 Padding. Takes a bytestring data and an optional blocksize 'bs'"""
    length = bs - (len(data) % bs)
    data += six.int2byte(length) * length
    return data