def make_linked_folder(sym_path):
    """
    Create a folder in the ~/.autolens directory and create a sym link to it at the provided path.

    If both folders already exist then nothing is changed. If the source folder exists but the destination folder does
    not then the source folder is removed and replaced so as to conform to the behaviour that the user would expect
    should they delete the sym linked folder.

    Parameters
    ----------
    sym_path: str
        The path where multinest output is apparently saved

    Returns
    -------
    actual_path: str
        The path where multinest output is actually saved
    """
    source_path = path_for(sym_path)
    if os.path.exists(source_path) and not os.path.exists(sym_path):
        logger.debug("Source {} exists but target {} does not. Removing source.".format(source_path, sym_path))
        shutil.rmtree(source_path)
    try:
        logger.debug("Making source {}".format(source_path))
        os.mkdir(source_path)
        logger.debug("Success")
    except FileExistsError as e:
        logger.info("Source already existed")
        logger.debug(e)
    try:
        logger.debug("Making linking from source {} to sym {}".format(source_path, sym_path))
        os.symlink(source_path, sym_path)
        logger.debug("Success")
    except FileExistsError as e:
        logger.debug("Sym already existed")
        logger.debug(e)
    return source_path