<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)