It's important for testing; otherwise it's impossible to make sure both implementations are doing the same thing (for instance, they weren't, until converting the salt from unicode, for M2Crypto). I wasn't sure where the testing code would go for this (I just tested manually with the final version), but this was my earlier testing code:

from pbkdf2 import crypt

    # import M2Crypto
    # import M2Crypto.EVP
    # from pbkdf2 import PBKDF2 as pbkdf2_py
    # pbkdf2_m2 = M2Crypto.EVP.pbkdf2

    def check_python(password, hash):
        return hash == crypt(password, hash, use_m2crypto=False)

    def check_m2(password, hash):
        return hash == crypt(password, hash)
        
    def encode_python(password):
        return crypt(password, iterations=2000, use_m2crypto=False)

    def encode_m2(password):
        return crypt(password, iterations=2000)
        

    def test():
        assert check_python("test", encode_python("test"))
        assert not check_python("testtest", encode_python("test"))

        assert check_m2("test", encode_m2("test"))
        assert not check_m2("testtest", encode_m2("test"))

        assert check_python("test", encode_m2("test"))
        assert not check_python("testtest", encode_m2("test"))

        assert check_m2("test", encode_python("test"))
        assert not check_m2("testtest", encode_python("test"))