py: Allow hashing of functions and tuples.