Updated code based on BertrandBordage's review
Check object type before trying to stupidily access _meta attribute