only use kwargs in memoize if function has kwargs