import hashlib


def PBKDF2(self, mnemonic, salt=""):
        """
        Uses the PBKDF2 key-stretching function to stretch the mnemonic to a 512-bit value.  The use
        of salt is optional

        Parameters:
            mnemonic (String): the mnemonic code words to stretch
            salt     (String): An additional security factor to protect the resulting seed

        Returns:
            The 512-bit seed created from the 2048 rounds of hashing of the mnemoni and salt 
        
        """
        mnemonic_bytes = mnemonic.encode()
        salt_bytes = ("mnemonic" + salt).encode()
        seed = hashlib.pbkdf2_hmac("sha512", mnemonic_bytes, salt_bytes, 2048)
        return seed.hex()