def parse_alert(server_handshake_bytes):
for record_type, _, record_data in parse_tls_records(server_handshake_bytes):<EOL><INDENT>if record_type != b'<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>if len(record_data) != <NUM_LIT:2>:<EOL><INDENT>return None<EOL><DEDENT>return (int_from_bytes(record_data[<NUM_LIT:0>:<NUM_LIT:1>]), int_from_bytes(record_data[<NUM_LIT:1>:<NUM_LIT:2>]))<EOL><DEDENT>return None<EOL>
Parses the handshake for protocol alerts

:param server_handshake_bytes:
    A byte string of the handshake data received from the server

:return:
    None or an 2-element tuple of integers:
     0: 1 (warning) or 2 (fatal)
     1: The alert description (see https://tools.ietf.org/html/rfc5246#section-7.2)