Can someone tell me what encryption this is and how I can implement it in python?

Can someone tell me what this encryption is please? And how I would implement the encryption in Python.

Encryption: https://pastebin.com/0Udvd44i

Usage:

this.outlookData.cipher = genCipher("", "", "newpwd", this.password, this.outlookData.randomNum, this.outlookData.key)