  def RemoveExternalIps(self) -> Dict[str, str]:
    """Removes any external IP of the instance, breaking ongoing connections.

    Note that if the instance's IP address was static, that
    the IP will still belong to the project.

    Returns:
      Dict[str, str]: A mapping from an instance's network
        interfaces to the corresponding removed external IP.

    Raises:
      errors.ResourceDeletionError: If the removal did not succeed.
    """
    external_ip_addresses = {}
    # Iterate through instance's network interfaces, removing
    # all access configurations (NAT)
    instance_info = self.GetOperation()
    for network_interface in instance_info.get('networkInterfaces', []):
      access_configs = network_interface.get('accessConfigs', [])
      if len(access_configs) == 0:
        # No way to access this network interface externally,
        # skip the removal
        continue
      network_interface_name = network_interface['name']
      # From the `get` operation response documentation, for
      # the `networkInterfaces[].accessConfigs[]` field:
      #
      # > Currently, only one access config, ONE_TO_ONE_NAT, is
      #   supported.
      #
      # It is thus safe to access only the first element.
      access_config = access_configs[0]
      access_config_name = access_config['name']
      external_ip_address = access_config['natIP']
      logger.info(
          'Deleting access config for {0:s} (external IP: {1:s})'.format(
              self.name,
              external_ip_address,
          ))
      # Execute the IP address removal by deleting access config
      gce_instance_client = self.GceApi().instances() # pylint: disable=no-member
      params = {
          'project': self.project_id,
          'zone': self.zone,
          'instance': self.name,
          'accessConfig': access_config_name,
          'networkInterface': network_interface_name
      }
      try:
        # Safe to unpack since this response is not paged
        response = common.ExecuteRequest(
            gce_instance_client, 'deleteAccessConfig', params)[0]
      except HttpError as exception:
        message = 'Unable to delete access config for {0:s}: {1:s}'.format(
            self.name, exception.error_details)
        raise errors.ResourceDeletionError(message, __name__) from exception
      self.BlockOperation(response, zone=self.zone)
      # Save deleted external IP address
      external_ip_addresses[network_interface_name] = external_ip_address
    # Return the deleted external IP address for future use
    return external_ip_addresses
Removes any external IP of the instance, breaking ongoing connections.

Note that if the instance's IP address was static, that
the IP will still belong to the project.

Returns:
Dict[str, str]: A mapping from an instance's network
interfaces to the corresponding removed external IP.

Raises:
errors.ResourceDeletionError: If the removal did not succeed.
libcloudforensics/providers/gcp/internal/compute.py