optimized the rare case of using functions as dict keys.