def _compute_teleport_distribution_from_ratings(user_rating, all_movies):
	"""
	returns the teleporting distribution as explained in the homework
	if a movie M has been rated, its probability is: RATE_M / SUM_OF_ALL_RATINGS
	else, its probability is: 0
	:param user_rating: a dict of (movie_id, rating)
	:param all_movies: a set of movie ids, either rated or not. It is used for filter
			the movies that have no rating, and then their probability will be set to 0.
	:return:
	"""
	distribution = {}
	rating_sum = sum(user_rating.values())
	for movie_id, rating in user_rating.items():
		distribution[movie_id]=rating/rating_sum
	for not_rated_movie in filter(lambda x: x not in distribution, all_movies):
		distribution[not_rated_movie] = 0

	return distribution