def is_websocket(headers):
 return (('upgrade' in headers.get('Connection', '').lower()) and (headers.get('Upgrade').lower() == 'websocket'))

def is_websocket ( headers ) : return ( ( 'upgrade' in headers . get ( 'Connection' , '' ) . lower ( ) ) and ( headers . get ( 'Upgrade' ) . lower ( ) == 'websocket' ) )
determine whether a given set of headers is asking for websockets .