def rm_file_or_dir(path, ignore_errors=True):
    """
    Helper function to clean a certain filepath

    Parameters
    ----------
    path

    Returns
    -------

    """
    if os.path.exists(path):
        if os.path.isdir(path):
            if os.path.islink(path):
                os.unlink(path)
            else:
                shutil.rmtree(path, ignore_errors=ignore_errors)
        else:
            if os.path.islink(path):
                os.unlink(path)
            else:
                os.remove(path)