code: def test__ensure_cr():
      # Make sure text ends with carriage return
      npt.assert_equal(_ensure_cr("  foo"), "  foo\n")
      npt.assert_equal(_ensure_cr("  foo\n"), "  foo\n")
      npt.assert_equal(_ensure_cr("  foo  "), "  foo\n")
      npt.assert_equal(_ensure_cr("foo  "), "foo\n")
      npt.assert_equal(_ensure_cr("foo  \n bar"), "foo  \n bar\n")
      npt.assert_equal(_ensure_cr("foo  \n\n"), "foo\n")
  
file_path: dipy/dipy/utils/tests/test_deprecator.py
imports: import sys
  import warnings
  import numpy.testing
  import pytest
  import dipy
  from dipy.testing import clear_and_catch_warnings, assert_true
  from dipy.utils.deprecator import cmp_pkg_version, _add_dep_doc, _ensure_cr, deprecate_with_version, deprecated_params, ArgsDeprecationWarning, ExpiredDeprecationError
label_desc: Use image node_id 2 for calling a global function with example usage: test__ensure_cr() without return types