'Build a response calling record_fn on all the TlsRecords in message
message: bytes to parse as TlsRecords
record_fn: one of on_tls_request, on_tls_response to handle the record
Returns tuple containing the bytes to send for all the records handled and any remaining unparsed data'

def _handle_message(self, message, buffer, record_fn):

    out = ''
    message = (buffer.buffer + message)
    buffer.buffer = ''
    remaining = message
    while remaining:
        record = None
        try:
            (record, remaining) = tls.parse_tls(remaining, throw_on_incomplete=True)
        except tls.types.TlsNotEnoughDataError:
            if buffer.should_buffer:
                buffer.buffer = remaining
                if (len(buffer.buffer) >= buffer.MAX_BUFFER):
                    buffer.buffer = ''
            return out
        if (not record):
            return out
        record_bytes = record_fn(record)
        if record_bytes:
            out += record_bytes
        if (record.content_type == record.CONTENT_TYPE.CHANGE_CIPHER_SPEC):
            buffer.should_buffer = False
    return out
