code: def download_files(self, files):
          
          utils.pending_message(
              "Downloading {nfiles} file{plural}...".format(
                  nfiles=len(files),
                  plural='s' if len(files) > 1 else ''
              ))
  
          for file in files:
              if 'file_id' not in file:
                  continue
  
              def build_callback(file):
                  """Callback to save a download file result to a file on disk."""
                  def file_callback(task):
                      device_name = self.devices[self.device_id]['device_name']
                      path_chunks = file['file_path'].split('/')
  
                      directory = os.path.join('files', device_name, *path_chunks[:-1])
  
                      filepath = utils.get_or_create_filepath(file['filename'], directory)
  
                      with open(filepath, 'wb') as out:
                          out.write(task.result)
  
                      if settings.getboolean('logging', 'time_profile'):
                          filepath = utils.append_profile_info(filepath, task.timer)
  
                      with indent(4):
                          utils.print_message(filepath)
  
                  return file_callback
  
              self.client.download_file(
                  account=self.account,
                  device=self.device_id,
                  file=file['file_id'],
                  callback=build_callback(file)
              )
docs: This method uses the `download_file` task to retrieve binary files
          such as attachments, images and videos.
  
          Notice that this method does not wait for the tasks it creates to return
          a result synchronously.