def rc2_cbc_pkcs5_encrypt(key, data, iv):
if len(key) < <NUM_LIT:5> or len(key) > <NUM_LIT:16>:<EOL><INDENT>raise ValueError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>len(key)<EOL>))<EOL><DEDENT>if not iv:<EOL><INDENT>iv = rand_bytes(<NUM_LIT:8>)<EOL><DEDENT>elif len(iv) != <NUM_LIT:8>:<EOL><INDENT>raise ValueError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>len(iv)<EOL>))<EOL><DEDENT>return (iv, _encrypt(Security.kSecAttrKeyTypeRC2, key, data, iv, Security.kSecPaddingPKCS5Key))<EOL>
Encrypts plaintext using RC2 with a 64 bit key

:param key:
    The encryption key - a byte string 8 bytes long

:param data:
    The plaintext - a byte string

:param iv:
    The 8-byte initialization vector to use - a byte string - set as None
    to generate an appropriate one

:raises:
    ValueError - when any of the parameters contain an invalid value
    TypeError - when any of the parameters are of the wrong type
    OSError - when an error is returned by the OS crypto library

:return:
    A tuple of two byte strings (iv, ciphertext)