On this line:
You are using
isValidHashDifficulty with one argument, but in the example above you define the function with at two arguments, hash and difficulty. You are also calling the function of some context as a method, yet above it is a plain function. How are these two resolved? Is this version a modified version attached to some class?