Read AMF L{Message} header from the stream.

    @type stream: L{BufferedByteStream<pyamf.util.BufferedByteStream>}
    @param decoder: An AMF0 decoder.
    @param strict: Use strict decoding policy. Default is C{False}. Will raise a
        L{pyamf.DecodeError} if the data that was read from the stream does not
        match the header length.
    @return: A C{tuple} containing the name of the header, a C{bool}
        determining if understanding this header is required and the decoded
        data.
    @note: Quite what understanding required headers actually means is unknown.

def _read_header(stream, decoder, strict=False):
    """
    Read AMF L{Message} header from the stream.

    @type stream: L{BufferedByteStream<pyamf.util.BufferedByteStream>}
    @param decoder: An AMF0 decoder.
    @param strict: Use strict decoding policy. Default is C{False}. Will raise a
        L{pyamf.DecodeError} if the data that was read from the stream does not
        match the header length.
    @return: A C{tuple} containing the name of the header, a C{bool}
        determining if understanding this header is required and the decoded
        data.
    @note: Quite what understanding required headers actually means is unknown.
    """
    name_len = stream.read_ushort()
    name = stream.read_utf8_string(name_len)

    required = bool(stream.read_uchar())

    data_len = stream.read_ulong()
    pos = stream.tell()

    data = decoder.readElement()

    if strict and pos + data_len != stream.tell():
        raise pyamf.DecodeError(
            "Data read from stream does not match header length")

    return (name, required, data)