code: def _write_sample_atlas_metadata(ho_dir, filename, is_symm):
      with open(os.path.join(ho_dir, f"{filename}.xml"), "w") as dm:
          if not is_symm:
              dm.write(
                  "<?xml version='1.0' encoding='us-ascii'?>\n"
                  "<data>\n"
                  '<label index="0" x="48" y="94" z="35">R1</label>\n'
                  '<label index="1" x="25" y="70" z="32">R2</label>\n'
                  '<label index="2" x="33" y="73" z="63">R3</label>\n'
                  "</data>"
              )
          else:
              dm.write(
                  "<?xml version='1.0' encoding='us-ascii'?>\n"
                  "<data>\n"
                  '<label index="0" x="63" y="86" z="49">Left R1</label>\n'
                  '<label index="1" x="21" y="86" z="33">Right R1</label>\n'
                  '<label index="2" x="64" y="69" z="32">Left R2</label>\n'
                  '<label index="3" x="26" y="70" z="32">Right R2</label>\n'
                  '<label index="4" x="47" y="75" z="66">Left R3</label>\n'
                  '<label index="5" x="43" y="80" z="61">Right R3</label>\n'
                  "</data>"
              )
          dm.close()
  
imports: import itertools
  import os
  import re
  from pathlib import Path
  import nibabel
  import numpy
  import pandas
  import pytest
  from numpy.testing import assert_array_equal
  from nilearn._utils import data_gen
  from nilearn._utils.testing import serialize_niimg
  from nilearn.conftest import _rng
  from nilearn.datasets import atlas
  from nilearn.datasets._utils import fetch_files
  from nilearn.datasets.tests._testing import dict_to_archive
  from nilearn.image import get_data
label_desc: Use image node_id 3 for calling a global function with example usage: _write_sample_atlas_metadata(ho_dir, filename, is_symm) without return types