Check if a message is available

def check(self, order, sids):
        ''' Check if a message is available '''
        payload = "{}"
        #TODO store hashes {'intuition': {'id1': value, 'id2': value}}
        # Block self.timeout seconds on self.channel for a message
        raw_msg = self.client.blpop(self.channel, timeout=self.timeout)
        if raw_msg:
            _, payload = raw_msg

            msg = json.loads(payload.replace("'", '"'), encoding='utf-8')
            for sid in msg.keys():
                #TODO Harmonize lower() and upper() symbols
                if sid.lower() in map(str.lower, sids):
                    print('ordering {} of {}'.format(msg[sid], sid))
                    #order(sid.upper(), msg[sid])
                    order(sid, msg[sid])
                else:
                    print('skipping unknown symbol {}'.format(sid))