code: def _stop_instance(self):
          
          try:
              vm_stop = self.compute.virtual_machines.power_off(
                  self.running_instance_id, self.running_instance_id
              )
          except Exception as error:
              raise AzureCloudException(
                  'Unable to stop instance: {0}.'.format(error)
              )
  
          vm_stop.wait()
docs: Stop the instance.