code: def _cloudpickle_dump_with_user_friendly_error(
      functions, description: str, file=None
  ):
      """Serializes functions, and throws user-friendly error upon failure."""
      try:
          if file:
              return cloudpickle.dump(functions, file)
          else:
              return cloudpickle.dumps(functions)
      except Exception as e:
          # When using `pdb`, we want to be able to go up the stack that goes into
          # the serialization error, not through the call-stack up to functions like
          # `check_nodes_are_serializable`. Thus, we need to propagate the traceback.
          raise RuntimeError(
              str(e.__class__.__name__) + ": " + str(e) + "\n"
              f"The nodes associated to {description} were "
              "not serializable using cloudpickle. Make them picklable, or pass "
              "`serialize_py_nodes=False` to `lp.launch` if you want to disable this "
              "check, for example when you want to use FLAGS, mocks, threading.Event "
              "etc, in your node definition."
          ).with_traceback(e.__traceback__) from e
  
file_path: launchpad/launchpad/launch/serialization.py
imports: import copyreg
  import functools
  from absl import flags
  import cloudpickle
  from launchpad import flags
label_desc: Use image node_id 2 for calling a global function with example usage: _cloudpickle_dump_with_user_friendly_error(functions, description, file) and returns: cloudpickle, cloudpickle