def download_attachments(self, dataset_identifier, content_type="json",
                             download_dir="~/sodapy_downloads"):
        '''
        Download all of the attachments associated with a dataset. Return the paths of downloaded
        files.
        '''
        metadata = self.get_metadata(dataset_identifier, content_type=content_type)
        files = []
        attachments = metadata['metadata'].get("attachments")
        if not attachments:
            logging.info("No attachments were found or downloaded.")
            return files

        download_dir = os.path.join(os.path.expanduser(download_dir), dataset_identifier)
        if not os.path.exists(download_dir):
            os.makedirs(download_dir)

        for attachment in attachments:
            file_path = os.path.join(download_dir, attachment["filename"])
            has_assetid = attachment.get("assetId", False)
            if has_assetid:
                base = _format_old_api_request(dataid=dataset_identifier)
                assetid = attachment["assetId"]
                resource = "{0}/files/{1}?download=true&filename={2}"\
                           .format(base, assetid, attachment["filename"])
            else:
                base = "/api/assets"
                assetid = attachment["blobId"]
                resource = "{0}/{1}?download=true".format(base, assetid)

            uri = "{0}{1}{2}".format(self.uri_prefix, self.domain, resource)
            _download_file(uri, file_path)
            files.append(file_path)

        logging.info("The following files were downloaded:\n\t{0}".format("\n\t".join(files)))
        return files
Download all of the attachments associated with a dataset. Return the paths of downloaded
        files.