def check_isinstance(obj, cls):
 if isinstance(obj, cls):
  return obj
 raise Exception((_('Expected object of type: %s') % str(cls)))
 return cls()

def check_isinstance ( obj , cls ) : if isinstance ( obj , cls ) : return obj raise Exception ( ( _ ( 'Expected object of type: %s' ) % str ( cls ) ) ) return cls ( )
checks that obj is of type cls .