<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rdtff(file_name, cut_end=False):
 """ Read values from a tff file Parameters file_name : str Name of the .tff file to read cut_end : bool, optional If True, cuts out the last sample for all channels. This is for reading files which appear to terminate with the incorrect number of samples (ie. sample not present for all channels). Returns ------- signal : numpy array A 2d numpy array storing the physical signals from the record. fields : dict A dictionary containing several key attributes of the read record. markers : numpy array A 1d numpy array storing the marker locations. triggers : numpy array A 1d numpy array storing the trigger locations. Notes ----- This function is slow because tff files may contain any number of escape sequences interspersed with the signals. There is no way to know the number of samples/escape sequences beforehand, so the file is inefficiently parsed a small chunk at a time. It is recommended that you convert your tff files to wfdb format. """

    file_size = os.path.getsize(file_name)
    with open(file_name, 'rb') as fp:
        fields, file_fields = _rdheader(fp)
        signal, markers, triggers = _rdsignal(fp, file_size=file_size,
                                              header_size=file_fields['header_size'],
                                              n_sig=file_fields['n_sig'],
                                              bit_width=file_fields['bit_width'],
                                              is_signed=file_fields['is_signed'],
                                              cut_end=cut_end)
    return signal, fields, markers, triggers