Function: custom-check-theme

Check whether THEME is valid, and signal an error if it is not.