add keyword argument support and key= keyword argument to function memoize

For supporting arguments that are not directly hashable. The test for this function is also added.

This is necessary for using `memoize` for `match_dtype_to_c_struct` on pypy..... since some dtype on pypy are not hashable....