def get_websockets(ws_type = None): websocket = WEBSOCKETS.get(ws_type, []) return websocket if websocket else None
How about just:
def get_websockets(ws_type=None): return WEBSOCKETS.get(ws_type, None)
Thanks meejah for the additional feedback! For this last one as I understand it WEBSOCKETS contains values that are empty lists, and he wants this function to return None when that's the case. That's why I did it the way above.