<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_file(self, record, field, return_format='json', event=None):
 """ Delete a file from REDCap Notes ----- There is no undo button to this. Parameters record : str record ID field : str field name return_format : (``'json'``), ``'csv'``, ``'xml'`` return format for error message event : str If longitudinal project, event to delete file from Returns ------- response : dict, str response from REDCap after deleting file """

        self._check_file_field(field)
        # Load up payload
        pl = self.__basepl(content='file', format=return_format)
        del pl['format']
        pl['returnFormat'] = return_format
        pl['action'] = 'delete'
        pl['record'] = record
        pl['field'] = field
        if event:
            pl['event'] = event
        return self._call_api(pl, 'del_file')[0]