if obj.pk is None, and Model has an 'natural_key' attribute, and Model._default_manager has and 'get_by_natural_key',
if ( obj . pk is None and hasattr ( Model , 'natural_key' ) and hasattr ( Model . _default_manager , 'get_by_natural_key' ) ) :