human
I wrote the below code

    def pad(text):
        '\n                                Pads    text    to    be    encrypted\n                                '
        pad_length = (blocksize - (len(text) % blocksize))
        pad = ''.join((six.int2byte(random.SystemRandom().randint(1, 255)) for i in range((pad_length - 1))))
        return ((text + '\x00') + pad)
    plaintext = encodeutils.to_utf8(plaintext)
    key = encodeutils.to_utf8(key)
    init_vector = os.urandom(16)
    backend = default_backend()
    cypher = Cipher(algorithms.AES(key), modes.CBC(init_vector), backend=backend)
    encryptor = cypher.encryptor()
    padded = (encryptor.update(pad(six.binary_type(plaintext))) + encryptor.finalize())
    encoded = base64.urlsafe_b64encode((init_vector + padded))
    if six.PY3:
        encoded = encoded.decode('ascii')
    return encoded

What's a good function header?
assistant
#Here's a good function header.

def urlsafe_encrypt(key, plaintext, blocksize=16):