def from_irafpath(irafpath):
s = irafpath.split('<STR_LIT:$>')<EOL>if len(s) != <NUM_LIT:2>:<EOL><INDENT>return irafpath<EOL><DEDENT>if len(s[<NUM_LIT:0>]) == <NUM_LIT:0>:<EOL><INDENT>return irafpath<EOL><DEDENT>try:<EOL><INDENT>refdir = os.environ[s[<NUM_LIT:0>]]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(s[<NUM_LIT:0>]))<EOL><DEDENT>return os.path.join(refdir, s[<NUM_LIT:1>])<EOL>
Resolve IRAF path like ``jref$`` into actual file path.

    Parameters
    ----------
    irafpath : str
        Path containing IRAF syntax.

    Returns
    -------
    realpath : str
        Actual file path. If input does not follow ``path$filename``
        format, then this is the same as input.

    Raises
    ------
    ValueError
        The required environment variable is undefined.