Check if key exists in kwargs.

(cherry picked from commit a3562677676fa9ab24df6014432a24876ba8ad8c)