def compute_average_speed(data_animal_id_groups, fps):
    """
	Function to compute average speed of an animal based on fps
	(frames per second) parameter. Calculate the average speed of a mover,
	based on the pandas dataframe and a frames per second (fps) parameter

	Formula used-
	Average Speed = Total Distance Travelled / Total Time taken

	Use output of compute_distance_and_direction() function to this function.

	Input- Python dict and fps
	Returns- Python dict
	"""
    for aid in data_animal_id_groups.keys():
        data_animal_id_groups[aid]['average_speed'] = data_animal_id_groups[aid
            ]['distance'].rolling(window=fps, win_type=None).sum() / fps
    return data_animal_id_groups
