code: def _build_landmarker_result(
      output_packets: Mapping[str, packet_module.Packet]
  ) -> FaceLandmarkerResult:
      """Constructs a `FaceLandmarkerResult` from output packets."""
      face_landmarks_proto_list = packet_getter.get_proto_list(
          output_packets[_NORM_LANDMARKS_STREAM_NAME]
      )
  
      face_landmarks_results = []
      for proto in face_landmarks_proto_list:
          face_landmarks = landmark_pb2.NormalizedLandmarkList()
          face_landmarks.MergeFrom(proto)
          face_landmarks_list = []
          for face_landmark in face_landmarks.landmark:
              face_landmarks_list.append(
                  landmark_module.NormalizedLandmark.create_from_pb2(
                      face_landmark
                  )
              )
          face_landmarks_results.append(face_landmarks_list)
  
      face_blendshapes_results = []
      if _BLENDSHAPES_STREAM_NAME in output_packets:
          face_blendshapes_proto_list = packet_getter.get_proto_list(
              output_packets[_BLENDSHAPES_STREAM_NAME]
          )
          for proto in face_blendshapes_proto_list:
              face_blendshapes_categories = []
              face_blendshapes_classifications = (
                  classification_pb2.ClassificationList()
              )
              face_blendshapes_classifications.MergeFrom(proto)
              for (
                  face_blendshapes
              ) in face_blendshapes_classifications.classification:
                  face_blendshapes_categories.append(
                      category_module.Category(
                          index=face_blendshapes.index,
                          score=face_blendshapes.score,
                          display_name=face_blendshapes.display_name,
                          category_name=face_blendshapes.label,
                      )
                  )
              face_blendshapes_results.append(
                  face_blendshapes_categories
              )
  
      facial_transformation_matrixes_results = []
      if _FACE_GEOMETRY_STREAM_NAME in output_packets:
          facial_transformation_matrixes_proto_list = (
              packet_getter.get_proto_list(
                  output_packets[_FACE_GEOMETRY_STREAM_NAME]
              )
          )
          for proto in facial_transformation_matrixes_proto_list:
              if hasattr(proto, "pose_transform_matrix"):
                  matrix_data = matrix_data_pb2.MatrixData()
                  matrix_data.MergeFrom(proto.pose_transform_matrix)
                  matrix = np.array(matrix_data.packed_data)
                  matrix = matrix.reshape(
                      (matrix_data.rows, matrix_data.cols)
                  )
                  matrix = (
                      matrix
                      if matrix_data.layout == _LayoutEnum.ROW_MAJOR
                      else matrix.T
                  )
                  facial_transformation_matrixes_results.append(matrix)
  
      return FaceLandmarkerResult(
          face_landmarks_results,
          face_blendshapes_results,
          facial_transformation_matrixes_results,
      )
  
imports: import dataclasses
  import enum
  from typing import Callable, Mapping, Optional, List
  import numpy
  from mediapipe.framework.formats import classification_pb2
  from mediapipe.framework.formats import landmark_pb2
  from mediapipe.framework.formats import matrix_data_pb2
  from mediapipe.python import packet_creator
  from mediapipe.python import packet_getter
  from mediapipe.python._framework_bindings import image
  from mediapipe.python._framework_bindings import packet
  from mediapipe.tasks.cc.vision.face_geometry.proto import face_geometry_pb2
  from mediapipe.tasks.cc.vision.face_landmarker.proto import face_landmarker_graph_options_pb2
  from mediapipe.tasks.python.components.containers import category
  from mediapipe.tasks.python.components.containers import landmark
  from mediapipe.tasks.python.core import base_options
  from mediapipe.tasks.python.core import task_info
  from mediapipe.tasks.python.core.optional_dependencies import doc_controls
  from mediapipe.tasks.python.vision.core import base_vision_task_api
  from mediapipe.tasks.python.vision.core import image_processing_options
  from mediapipe.tasks.python.vision.core import vision_task_running_mode
label_desc: Use image node_id 1 for calling a global function with example usage: _build_landmarker_result(output_packets) and returns: FaceLandmarkerResult