The moved 'self.flush_multipath_device(mpath_dev['id'])' needs to be placed inside the if statement as flush_multipath_device can return a None.
The moved 'self.flush_ multipath_ device( mpath_dev[ 'id'])' needs to be placed inside the if statement as flush_multipath _device can return a None.