code: def convert_to_traits_type(dipy_type, is_file=False):
      """Convert DIPY type to Traits type."""
      dipy_type = dipy_type.lower()
      is_mandatory = bool("optional" not in dipy_type)
      if "variable" in dipy_type and "str" in dipy_type:
          return traits.ListStr, is_mandatory
      elif "variable" in dipy_type and "int" in dipy_type:
          return traits.ListInt, is_mandatory
      elif "variable" in dipy_type and "float" in dipy_type:
          return traits.ListFloat, is_mandatory
      elif "variable" in dipy_type and "bool" in dipy_type:
          return traits.ListBool, is_mandatory
      elif "variable" in dipy_type and "complex" in dipy_type:
          return traits.ListComplex, is_mandatory
      elif "str" in dipy_type and not is_file:
          return traits.Str, is_mandatory
      elif "str" in dipy_type and is_file:
          return File, is_mandatory
      elif "int" in dipy_type:
          return traits.Int, is_mandatory
      elif "float" in dipy_type:
          return traits.Float, is_mandatory
      elif "bool" in dipy_type:
          return traits.Bool, is_mandatory
      elif "complex" in dipy_type:
          return traits.Complex, is_mandatory
      else:
          msg = f"Error during convert_to_traits_type({dipy_type}). Unknown DIPY type."
          raise OSError(msg)
  
file_path: nipype/nipype/interfaces/dipy/base.py
imports: import os.path
  import inspect
  import numpy
  from ...None import logging
  from ..base import traits, File, isdefined, LibraryBaseInterface, BaseInterfaceInputSpec, TraitedSpec
label_desc: Use image node_id 4 for calling a global function with example usage: convert_to_traits_type(dipy_type, is_file) and returns: traits,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory, File,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory, traits,  is_mandatory