import requests
from bs4 import BeautifulSoup


def get_ansible_modules(url):
    """ This function returns a dictionary which each key is the name of an ansible module and the value is its description """

    response = requests.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')

    span_list = soup.find_all('span', class_='std std-ref')
    module_dict = {}
    for span in span_list:
        span_text = span.text
        split_text = span_text.split(' – ', 1)
        key = split_text[0]
        value = split_text[1]
        module_dict[key] = value

    return module_dict