def add_to_playlist(hash, publc, atpl_id, list_ids): x = Playlists() # create a hash m = md5.new(atpl_id + publc + _private_key()) # check if this hash is equal to the one transmitted if m.hexdigest() == hash: param = { 'atpl_id' : atpl_id, 'list_ids': list_ids } data = x.add_to_playlist(param) dat = { 'response' : data } else: dat = { 'response' : '' } return dat