<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def download(self, filename=None, as_type='zip'):
 """ Download the IPList. List format can be either zip, text or json. For large lists, it is recommended to use zip encoding. Filename is required for zip downloads. :param str filename: Name of file to save to (required for zip) :param str as_type: type of format to download in: txt,json,zip (default: zip) :raises IOError: problem writing to destination filename :return: None """

        headers = None
        if as_type in ['zip', 'txt', 'json']:
            if as_type == 'zip':
                if filename is None:
                    raise MissingRequiredInput('Filename must be specified when '
                                               'downloading IPList as a zip file.')
                filename = '{}'.format(filename)
            elif as_type == 'txt':
                headers = {'accept': 'text/plain'}
            elif as_type == 'json':
                headers = {'accept': 'application/json'}
        
            result = self.make_request(
                FetchElementFailed,
                raw_result=True,
                resource='ip_address_list',
                filename=filename,
                headers=headers)
        
            return result.json if as_type == 'json' else result.content