code: def make_courier_server(
      instance: Any, *courier_args, **courier_kwargs
  ) -> courier.Server:
      """Builds a courier.Server for an instance.
  
  
      Args:
        instance: The instance that the courier server associates with.
        *courier_args: positional arguments to pass to courier.Server().
        **courier_kwargs: keyword arguments to pass to courier.Server().
  
      Returns:
        A courier.Server object.
      """
      server = courier.Server(*courier_args, **courier_kwargs)
  
      # Bind all non-private user-defined local methods.
      for method_name in dir(instance):
          func = getattr(instance, method_name)
          if _should_expose_method(func, method_name):
              logging.info("Binding: %s", method_name)
              handler = None
              if func.__dict__.get("_batched_handler", False):
                  if handler is None:
                      handler = pybind.BuildPyCallHandler(
                          func.__dict__["_func"]
                      )
                  batch_size = func.__dict__["_batch_size"]
                  max_parallelism = func.__dict__["_max_parallelism"]
                  timeout = func.__dict__["_timeout"]
                  pad_batch = func.__dict__["_pad_batch"]
                  handler = pybind.BuildBatchedHandlerWrapper(
                      method_name,
                      handler,
                      batch_size,
                      max_parallelism,
                      timeout,
                      pad_batch,
                  )
              if handler is None:
                  handler = pybind.BuildPyCallHandler(func)
              server.BindHandler(method_name, handler)
  
      return server
  
file_path: launchpad/launchpad/nodes/courier/courier_utils.py
imports: import datetime
  import functools
  import inspect
  from typing import Any, Callable, Text
  from absl import logging
  import courier
  from courier.handlers.python import pybind
label_desc: Use image node_id 3 for calling a global function with example usage: make_courier_server(instance) and returns: server