'Attempt to calculate if TCP backpressure is being applied due to
our outbound buffer being larger than the average frame size over
a window of frames.'

def _detect_backpressure(self):

    avg_frame_size = (self.bytes_sent / self.frames_sent)
    buffer_size = sum([len(f) for f in self.outbound_buffer])
    if (buffer_size > (avg_frame_size * self._backpressure_multiplier)):
        LOGGER.warning(BACKPRESSURE_WARNING, buffer_size, int((buffer_size / avg_frame_size)))
        self.callbacks.process(0, self.ON_CONNECTION_BACKPRESSURE, self)
