If you are trying to build an application in python for real-life mining, you can't really build the SHA256d hashing part. You can only really build the part that receives all of the hashes generated thus far by the mining hardware and send them to a pool like ViaBTC's and retrieve the next range back from it.