def download_images(soup):
"""Docstring here."""
for link in soup.findAllfind_all('img'):
image_url = link.get('src')
if validate(image_url):
image = requests.get(image_url)
if image.status_code == 200:
with open(image_name(), 'wb') as f:
f.write(image.content)
If you don't know what's with if __name__ == '__main__'
you can read more about it here
More, note that all the functions have a docstring which contain a placeholder like "Docstring here.". You can replace that placeholder with a summary that describes what each function does.