Run command if no mouse or keyboard input

I would like a script that would run pm-suspend if there has been no keyboard or mouse input for a specified time.

------ Post updated at 11:17 AM ------

Never mind. I found a setting in power management that does what I need.