docs: def _get_prm_file(file_name=None, search_order=None):
      """returns name of the prm file"""
      if file_name is not None:
          if os.path.isfile(file_name):
              return file_name
          else:
              logger.info("Could not find the prm-file")
  
      default_name = prms._prm_default_name
      prm_globtxt = prms._prm_globtxt
  
      script_dir = os.path.abspath(os.path.dirname(__file__))
  
      search_path = dict()
      search_path["curdir"] = os.path.abspath(os.path.dirname(sys.argv[0]))
      search_path["filedir"] = script_dir
      search_path["userdir"] = os.path.expanduser("~")
  
      if search_order is None:
          search_order = ["userdir", ]  # ["curdir","filedir", "userdir",]
      else:
          search_order = search_order
  
      # The default name for the prm file is at the moment in the script-dir,@
      # while default searching is in the userdir (yes, I know):
      prm_default = os.path.join(script_dir, default_name)
  
      # -searching-----------------------
      search_dict = OrderedDict()
  
      for key in search_order:
          search_dict[key] = [None, None]
          prm_directory = search_path[key]
          default_file = os.path.join(prm_directory, default_name)
  
          if os.path.isfile(default_file):
              # noinspection PyTypeChecker
              search_dict[key][0] = default_file
  
          prm_globtxt_full = os.path.join(prm_directory, prm_globtxt)
  
          user_files = glob.glob(prm_globtxt_full)
  
          for f in user_files:
              if os.path.basename(f) != os.path.basename(default_file):
                  search_dict[key][1] = f
                  break
  
      # -selecting----------------------
      prm_file = None
      for key, file_list in search_dict.items():
          if file_list[-1]:
              prm_file = file_list[-1]
              break
          else:
              if not prm_file:
                  prm_file = file_list[0]
  
      if prm_file:
          prm_filename = prm_file
      else:
          prm_filename = prm_default
  
      return prm_filename