In Python 2, objects automatically inherit the __hash__ of their parent
class. In Python 3, objects that override __eq__ do not automatically inherit
__hash__, so these objects were not hashable under Python 3. Additionally,
mutable BSON types and types that overide __eq__ but did not explicitly define
__hash__ had broken __hash__ methods under Python 2. This commit unifies the
hashing behavior between Python versions and fixes the __hash__ methods such
that two BSON objects hash the same only if they are equal.
N.B.: bson.code.Code and bson.regex.Regex are no longer hashable under Python 2
because they are mutable.
These are the last two places that aren't properly using/handling
timezone_aware datetime instances. This is a BREAKING change,
depending on how an application is using the datetime instances
returned.