<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _skew_sig(sig, skew, n_sig, read_len, fmt, nan_replace, samps_per_frame=None):
 """ Skew the signal, insert nans and shave off end of array if needed. Parameters sig : numpy array The original signal skew : list List of samples to skew for each signal n_sig : int The number of signals Notes ----- `fmt` is just for the correct nan value. `samps_per_frame` is only used for skewing expanded signals. """

    if max(skew)>0:

        # Expanded frame samples. List of arrays.
        if isinstance(sig, list):
            # Shift the channel samples
            for ch in range(n_sig):
                if skew[ch]>0:
                    sig[ch][:read_len*samps_per_frame[ch]] = sig[ch][skew[ch]*samps_per_frame[ch]:]

            # Shave off the extra signal length at the end
            for ch in range(n_sig):
                sig[ch] = sig[ch][:read_len*samps_per_frame[ch]]

            # Insert nans where skewed signal overran dat file
            for ch in range(n_sig):
                if nan_replace[ch]>0:
                    sig[ch][-nan_replace[ch]:] = _digi_nan(fmt)
        # Uniform array
        else:
            # Shift the channel samples
            for ch in range(n_sig):
                if skew[ch]>0:
                    sig[:read_len, ch] = sig[skew[ch]:, ch]
            # Shave off the extra signal length at the end
            sig = sig[:read_len, :]

            # Insert nans where skewed signal overran dat file
            for ch in range(n_sig):
                if nan_replace[ch]>0:
                    sig[-nan_replace[ch]:, ch] = _digi_nan(fmt)

    return sig