code: def stop_instance(self, instance_id):
          
          if not instance_id:
              log.info("Instance to stop has no instance id")
              return
  
          gce = self._connect()
  
          try:
              request = gce.instances().delete(project=self._project_id,
                                          instance=instance_id, zone=self._zone)
              response = self._execute_request(request)
              self._check_response(response)
          except HttpError as e:
              # If the instance does not exist, we get a 404
              if e.resp.status == 404:
                  raise InstanceNotFoundError(
                      "Instance `{instance_id}` was not found"
                      .format(instance_id=instance_id))
              else:
                  raise InstanceError(
                      "Could not stop instance `{instance_id}`: `{e}`"
                      .format(instance_id=instance_id, e=e))
          except CloudProviderError as e:
              raise InstanceError(
                  "Could not stop instance `{instance_id}`: `{e}`"
                  .format(instance_id=instance_id, e=e))
docs: Stops the instance gracefully.
  
          :param str instance_id: instance identifier
          :raises: `InstanceError` if instance can not be stopped