Stop subclasses of stateflow'd classes from exploding.

The way that stateflow was looking on the immediate class for a Machine was causing things to explode when being subclassed. Searching the ancestor chain for functioning Machines means that subclasses can inherit their superclasses' state machines.