Checking if the first argument to Form is a function or string in a more pythonic way

Thanks to @luizarmesto for the suggestion for the use of module collections