code: def list_instances(self, filter=None):
          
          gce = self._connect()
  
          try:
              request = gce.instances().list(
                  project=self._project_id, filter=filter, zone=self._zone)
              response = self._execute_request(request)
              self._check_response(response)
          except (HttpError, CloudProviderError) as e:
              raise InstanceError("could not retrieve all instances on the "
                                  "cloud: ``" % e)
  
          if response and 'items' in response:
              return response['items']
          else:
              return list()
docs: List instances on GCE, optionally filtering the results.
  
          :param str filter: Filter specification; see https://developers.google.com/compute/docs/reference/latest/instances/list for details.
          :return: list of instances