docs: def irafconvert(iraffilename):
      """Convert the IRAF file name to its Unix equivalent.
  
      Input can be in ``directory$file`` or ``$directory/file`` format.
      If ``'$'`` is not found in the input string, it is returned as-is.
  
      Parameters
      ----------
      iraffilename : str
          Filename in IRAF format.
  
      Returns
      -------
      unixfilename : str
          Filename in Unix format.
  
      Raises
      ------
      AttributeError
          Input is not a string.
  
      """
      convertdict = CONVERTDICT
  
      # remove duplicate separators and extraneous relative paths
      if not iraffilename.lower().startswith(('http', 'ftp')):
          iraffilename = os.path.normpath(iraffilename)
  
      # BUG: supports environment variables only as the leading element in the
      #      filename
      if iraffilename.startswith('$'):
          # Then this is an environment variable.
          # Use a regex to pull off the front piece.
          pat = re.compile(r'\$(\w*)')
          match = re.match(pat, iraffilename)
          dirname = match.group(1)
          unixdir = os.environ[dirname]
          basename = iraffilename[match.end() + 1:]  # 1 to omit leading slash
          unixfilename = os.path.join(unixdir, basename)
          return unixfilename
      elif '$' in iraffilename:
          # Then it's an iraf-style variable
          irafdir, basename = iraffilename.split('$')
          if irafdir == 'synphot':
              return get_data_filename(os.path.basename(basename))
          unixdir = convertdict[irafdir]
          unixfilename = os.path.join(unixdir, basename)
          return unixfilename
      else:
          # If no $ sign found, just return the filename unchanged
          return iraffilename