def add_playlist(param): x = Playlists() hash = param['hash'] publc = str(param['publc']) # create a hash m = md5.new(publc + _private_key()) # check if this hash is equal to the one transmitted if m.hexdigest() == hash: data = { 'username' : param['username'], 'playlist' : param['pl_name'], 'description': param['pl_desc'], 'tags' : param['pl_tags'], 'key' : _private_key() } return x.add_playlist(data) else: return 'failed'