<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def clear_output(output=None):
    '''
    Remove file targets in `_output` when a step fails to complete
    '''
    for target in env.sos_dict['_output'] if output is None else output:
        if isinstance(target, file_target) and target.exists():
            try:
                target.unlink()
            except Exception as e:
                env.logger.warning(f'Failed to remove {target}: {e}')