Move kwargs definition inside try block

Signed-off-by: Don Naegely <naegelyd@gmail.com>