def _clean_check(cmd, target):
try:<EOL><INDENT>subprocess.check_call(cmd)<EOL><DEDENT>except subprocess.CalledProcessError:<EOL><INDENT>if os.access(target, os.F_OK):<EOL><INDENT>os.unlink(target)<EOL><DEDENT>raise<EOL><DEDENT>
Run the command to download target. If the command fails, clean up before
re-raising the error.