I've reverted this back to a `if ... elif ... else` chain beginning with `if key is not None` in my local repo.  Two reasons:

1. this is faster for default usage case when a key function is not provided, and
2. if users inspect the returned `memof` function, they can see exactly how keys are calculated.