code: def _run_task_hook(hooks, method, task, queue_name):
    
    if hooks is not None:
      try:
        getattr(hooks, method)(task, queue_name)
      except NotImplementedError:
        # Use the default task addition implementation.
        return False
  
      return True
    return False
docs: Invokes hooks.method(task, queue_name).
  
    Args:
      hooks: A hooks.Hooks instance or None.
      method: The name of the method to invoke on the hooks class e.g.
          "enqueue_kickoff_task".
      task: The taskqueue.Task to pass to the hook method.
      queue_name: The name of the queue to pass to the hook method.
  
    Returns:
      True if the hooks.Hooks instance handled the method, False otherwise.