class_docstr: Hook for Google Cloud Spanner APIs.
  
  All the methods in the hook where project_id is used must be called with
  keyword arguments rather than positional.
class_docstr_tok: ["Hook","for","Google","Cloud","Spanner","APIs",".","All","the","methods","in","the","hook","where","project_id","is","used","must","be","called","with","keyword","arguments","rather","than","positional","."]
docstr: Invokes a method on a given instance by applying a specified Callable.
  
  :param project_id: The ID of the Google Cloud project that owns the Cloud Spanner database.
  :param instance_id: The ID of the instance.
  :param configuration_name: Name of the instance configuration defining how the
      instance will be created. Required for instances which do not yet exist.
  :param node_count: (Optional) Number of nodes allocated to the instance.
  :param display_name: (Optional) The display name for the instance in the Cloud
      Console UI. (Must be between 4 and 30 characters.) If this value is not set
      in the constructor, will fall back to the instance ID.
  :param func: Method of the instance to be called.
docstr_tok: ["Invokes","a","method","on","a","given","instance","by","applying","a","specified","Callable",".",":","param","project_id",":","The","ID","of","the","Google","Cloud","project","that","owns","the","Cloud","Spanner","database",".",":","param","instance_id",":","The","ID","of","the","instance",".",":","param","configuration_name",":","Name","of","the","instance","configuration","defining","how","the","instance","will","be","created",".","Required","for","instances","which","do","not","yet","exist",".",":","param","node_count",":","(","Optional",")","Number","of","nodes","allocated","to","the","instance",".",":","param","display_name",":","(","Optional",")","The","display","name","for","the","instance","in","the","Cloud","Console","UI",".","(","Must","be","between","4","and","30","characters",".",")","If","this","value","is","not","set","in","the","constructor",",","will","fall","back","to","the","instance","ID",".",":","param","func",":","Method","of","the","instance","to","be","called","."]
code: def _apply_to_instance(
      self,
      project_id: str,
      instance_id: str,
      configuration_name: str,
      node_count: int,
      display_name: str,
      func: Callable[[Instance], Operation],
  ) -> None:
      """
      Invokes a method on a given instance by applying a specified Callable.
  
      :param project_id: The ID of the Google Cloud project that owns the Cloud Spanner database.
      :param instance_id: The ID of the instance.
      :param configuration_name: Name of the instance configuration defining how the
          instance will be created. Required for instances which do not yet exist.
      :param node_count: (Optional) Number of nodes allocated to the instance.
      :param display_name: (Optional) The display name for the instance in the Cloud
          Console UI. (Must be between 4 and 30 characters.) If this value is not set
          in the constructor, will fall back to the instance ID.
      :param func: Method of the instance to be called.
      """
      instance = self._get_client(project_id=project_id).instance(
          instance_id=instance_id,
          configuration_name=configuration_name,
          node_count=node_count,
          display_name=display_name,
      )
      try:
          operation: Operation = func(instance)
      except GoogleAPICallError as e:
          self.log.error("An error occurred: %s. Exiting.", e.message)
          raise e
  
      if operation:
          result = operation.result()
          self.log.info(result)
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Callable, NamedTuple, Sequence
  from google.api_core.exceptions import AlreadyExists, GoogleAPICallError
  from google.cloud.spanner_v1.client import Client
  from sqlalchemy import create_engine
  from airflow.exceptions import AirflowException
  from airflow.providers.common.sql.hooks.sql import DbApiHook
  from airflow.providers.google.common.consts import CLIENT_INFO
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook, get_field
label_desc: Use image node_id 7 for calling the SpannerHook obj's underlying member method code with example usage: obj._apply_to_instance(project_id, instance_id, configuration_name, node_count, display_name, func) without return types