code: def make_cloud_mlengine_request_fn(credentials, model_name, version):
      """Wraps function to make CloudML Engine requests with runtime args."""
  
      def _make_cloud_mlengine_request(examples):
          """Builds and sends requests to Cloud ML Engine."""
          api = discovery.build("ml", "v1", credentials=credentials)
          parent = "projects/%s/models/%s/versions/%s" % (
              cloud.default_project(),
              model_name,
              version,
          )
          input_data = {
              "instances": [
                  {  # pylint: disable=g-complex-comprehension
                      "input": {
                          "b64": base64.b64encode(
                              ex.SerializeToString()
                          )
                      }
                  }
                  for ex in examples
              ]
          }
          response = (
              api.projects()
              .predict(body=input_data, name=parent)
              .execute()
          )
          predictions = response["predictions"]
          for prediction in predictions:
              prediction["outputs"] = np.array([prediction["outputs"]])
              prediction["scores"] = np.array(prediction["scores"])
          return predictions
  
      return _make_cloud_mlengine_request
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import base64
  import functools
  from googleapiclient import discovery
  import grpc
  import numpy
  from tensor2tensor import problems
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.utils import cloud_mlengine
  from tensor2tensor.utils import contrib
  import tensorflow.compat.v1
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import prediction_service_pb2_grpc
label_desc: Use image node_id 6 for calling a global function with example usage: make_cloud_mlengine_request_fn(credentials, model_name, version) and returns: _make_cloud_mlengine_request, predictions