def found_terminator(self): data = loads(self._ibuffer) self._ibuffer = b"" if type(dict()) == type(data) and 'action' in data: [getattr(self, n)(data) for n in ('Network_' + data['action'], 'Network') if hasattr(self, n)] else: print("OOB data:", data)