code: def test_ap():
      assert ap([1, 2], "%2d") == " 1,  2"
      assert ap([1, 2], "%3d") == "  1,   2"
      assert ap([1, 2], "%-2d") == "1 , 2 "
      assert ap([1, 2], "%d", "+") == "1+2"
      assert ap([1, 2, 3], "%d", "-") == "1-2-3"
  
file_path: nibabel/nibabel/cmdline/tests/test_utils.py
imports: from io import StringIO
  from os.path import join
  import numpy
  import pytest
  import nibabel
  from nibabel.cmdline.diff import *
  from nibabel.cmdline.utils import *
  from nibabel.testing import data_path
label_desc: Use image node_id 2 for calling a global function with example usage: test_ap() without return types