def get_sys_path(rcpath, app_name, section_name=None):
<EOL>if op.exists(rcpath):<EOL><INDENT>return op.realpath(op.expanduser(rcpath))<EOL><DEDENT>try:<EOL><INDENT>settings = rcfile(app_name, section_name)<EOL><DEDENT>except:<EOL><INDENT>raise<EOL><DEDENT>try:<EOL><INDENT>sys_path = op.expanduser(settings[rcpath])<EOL><DEDENT>except KeyError:<EOL><INDENT>raise IOError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(rcpath,<EOL>section_name,<EOL>app_name))<EOL><DEDENT>else:<EOL><INDENT>if not op.exists(sys_path):<EOL><INDENT>raise IOError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(rcpath, section_name, app_name,<EOL>sys_path))<EOL><DEDENT>return op.realpath(op.expanduser(sys_path))<EOL><DEDENT>
Return a folder path if it exists.

    First will check if it is an existing system path, if it is, will return it
    expanded and absoluted.

    If this fails will look for the rcpath variable in the app_name rcfiles or
    exclusively within the given section_name, if given.

    Parameters
    ----------
    rcpath: str
        Existing folder path or variable name in app_name rcfile with an
        existing one.

    section_name: str
        Name of a section in the app_name rcfile to look exclusively there for
        variable names.

    app_name: str
        Name of the application to look for rcfile configuration files.

    Returns
    -------
    sys_path: str
        A expanded absolute file or folder path if the path exists.

    Raises
    ------
    IOError if the proposed sys_path does not exist.