import os
from urllib.request import urlretrieve

def fetch_latest_backup(destination_path,
                        aws_bucket='serenata-de-amor-data',
                        aws_region='s3-sa-east-1'):
    files = ['2016-08-08-current-year.xz',
             '2016-08-08-last-year.xz',
             '2016-08-08-previous-years.xz',
             '2016-08-08-ceap-datasets.md',
             '2016-08-08-datasets-format.html',
             '2016-09-03-companies.xz',
             '2016-11-11-congressperson-relatives.xz',
             '2016-11-19-current-year.xz',
             '2016-11-19-last-year.xz',
             '2016-11-19-previous-years.xz',
             '2016-11-19-reimbursements.xz',
             '2016-11-28-congressperson-civil-names.xz']
    for filename in files:
        url = 'https://{}.amazonaws.com/{}/{}'.format(aws_region,
                                                      aws_bucket,
                                                      filename)
        filepath = os.path.join(destination_path, filename)
        if not os.path.exists(filepath):
            urlretrieve(url, filepath)

@@ -43,16 +43,451 @@
 trieve%0A%0A
+def fetch(filename, destination_path,%0A          aws_bucket='serenata-de-amor-data',%0A          aws_region='s3-sa-east-1'):%0A    url = 'https://%7B%7D.amazonaws.com/%7B%7D/%7B%7D'.format(aws_region,%0A                                                  aws_bucket,%0A                                                  filename)%0A    filepath = os.path.join(destination_path, filename)%0A    if not os.path.exists(filepath):%0A        urlretrieve(url, filepath)%0A%0A
 def fetc
@@ -1216,332 +1216,62 @@
     
-url = 'https://%7B%7D.amazonaws.com/%7B%7D/%7B%7D'.format(aws_region,%0A                                                      aws_bucket,%0A                                                      filename)%0A        filepath = os.path.join(destination_path, filename)%0A        if not os.path.exists(filepath):%0A            urlretrieve(url, filepath
+fetch(filename, destination_path, aws_bucket, aws_region
 )%0A

Create function to download a single dataset from AWS