Some more error checking for the automatically generated accessor function.
Robustly get the name of wanted attribute from the method name, either the raw version or the simplified one.