Created hash function rather than use python's due to lack of consistency in function