code: def get_ips(self, instance_id):
          
          if not instance_id:
            raise InstanceError("could not retrieve the ip address for node: "
                                "no associated instance id")
          gce = self._connect()
          instances = gce.instances()
          try:
              request = instances.get(instance=instance_id,
                                      project=self._project_id, zone=self._zone)
              response = self._execute_request(request)
              ip_public = None
  
              # If the instance is in status TERMINATED, then there will be
              # no IP addresses.
              if response and response['status'] in ('STOPPING', 'TERMINATED'):
                log.info("node '%s' state is '%s'; no IP address(es)" %
                         (instance_id, response['status']))
                return [None]
  
              if response and "networkInterfaces" in response:
                  interfaces = response['networkInterfaces']
                  if interfaces:
                      if "accessConfigs" in interfaces[0]:
                          ip_public = interfaces[0]['accessConfigs'][0]['natIP']
  
              if ip_public:
                  return [ip_public]
              else:
                  raise InstanceError("could not retrieve the ip address for "
                                      "node `%s`, please check the node "
                                      "through the cloud provider interface"
                                      % instance_id)
  
          except (HttpError, CloudProviderError) as e:
              raise InstanceError('could not retrieve the ip address of `%s`: '
                                  '`%s`' % (instance_id, e))
docs: Retrieves the ip addresses (public) from the cloud
          provider by the given instance id.
  
          :param str instance_id: id of the instance
          :return: list (ips)
          :raises: InstanceError if the ip could not be retrieved.