code: def _pad(input_signal, length, average=10):
      
      padded_input_signal = numpy.zeros(length, input_signal.dtype)
      start_offset = int((len(padded_input_signal) - len(input_signal)) / 2)
      padded_input_signal[:start_offset] = numpy.average(input_signal[0:average])
      padded_input_signal[start_offset:(start_offset + len(input_signal))] = input_signal[:]
      padded_input_signal[(start_offset + len(input_signal)):] = numpy.average(input_signal[-average:])
      return padded_input_signal
docs: Helper function which increases the length of an input signal. The original
      is inserted at the centre of the new signal and the extra values are set to
      the average of the first and last parts of the original, respectively.
  
      :param input_signal: the signal to be padded
      :param length: the length of the padded signal
      :param average: the number of points at the beginning/end of the signal
      which are averaged to calculate the padded value
      :return: