def encrypt(text, key=None):
    """
    Encrypts the inputted text using the AES cipher.  If the PyCrypto
    module is not included, this will simply encode the inputted text to
    base64 format.
    
    :param      text    | <str>
                key     | <str>
    
    :return     <str>
    """
    if key is None:
        key = ENCRYPT_KEY

    bits = len(key)
    text = pad(text, bits)
    iv = Random.new().read(16)
    cipher = AES.new(key, AES.MODE_CBC, iv)
    return base64.b64encode(iv + cipher.encrypt(text))
def encrypt ( text , key = None ) : if key is None : key = ENCRYPT_KEY bits = len ( key ) text = pad ( text , bits ) iv = Random . new ( ) . read ( 16 ) cipher = AES . new ( key , AES . MODE_CBC , iv ) return base64 . b64encode ( iv + cipher . encrypt ( text ) )
Encrypts the inputted text using the AES cipher.  If the PyCrypto
    module is not included, this will simply encode the inputted text to
    base64 format.
    
    :param      text    | <str>
                key     | <str>
    
    :return     <str>