I think you can use `$form instanceof FieldsetPrepareAwareInterface` here.