code: def _write(moe, path):
      print("Wrting to {0}".format(path))
  
      try:
          with open(path, "wb") as fout:
              fout.write(moe.SerializeToString())
      except Exception:
          print("Saving PB fails. Save HDF5 instead!")
          if os.path.exists(path):
              os.remove(path)
          path = path.replace("pb", "hdf5")
          import h5py
  
          f = h5py.File(path, "w")
          save_proto_to_hdf5(moe, f)
          f.close()
  
file_path: lightseq/examples/inference/python/export/fairseq/native_fs_moe_transformer_export.py
imports: import os
  import torch
  import argparse
  import numpy
  from collections import OrderedDict
  import lightseq.inference
  from proto.moe_pb2 import Moe
  from lightseq.training.ops.pytorch.export import gather_token_embedding, export_ls_config
  from lightseq.training.ops.pytorch.util import get_pos_embedding
label_desc: Use image node_id 6 for calling a global function with example usage: _write(moe, path) without return types