docs: def download(sid, credentials=None, subjects_path=None, overwrite=False, release='HCP_1200',
               database='hcp-openaccess', file_list=None):
      '''
      download(sid) downloads the data for subject with the given subject id. By default, the subject
        will be placed in the first HCP subject directory in the subjects directories list.
  
      Note: In order for downloading to work, you must have s3fs installed. This is not a requirement
      for the neuropythy library and does not install automatically when installing via pip. The
      github repository for this library can be found at https://github.com/dask/s3fs. Installation
      instructions can be found here: http://s3fs.readthedocs.io/en/latest/install.html
  
      Accepted options include:
        * credentials (default: None) may be used to specify the Amazon AWS Bucket credentials, which
          can be generated from the HCP db (https://db.humanconnectome.org/). If this argument can be
          coerced to a credentials tuple via the to_credentials function, that result will be used. If
          None, then the function will try to use the hcp_credentials configuration item in
          neuropythy.config; otherwise an error is raised.
        * subjects_path (default: None) specifies where the subject should be placed. If None, then
          the first directory in the subjects paths list is used. If there is not one of these then
          an error is raised.
        * overwrite (default: False) specifies whether or not to overwrite files that already exist.
          In addition to True (do overwrite) and False (don't overwrite), the value 'error' indicates
          that an error should be raised if a file already exists.
      '''
      if s3fs is None:
          raise RuntimeError('s3fs was not successfully loaded, so downloads may not occur; check '
                             'your Python configuration to make sure that s3fs is installed. See '
                             'http://s3fs.readthedocs.io/en/latest/install.html for details.')
      if credentials is None: credentials = config['hcp_credentials']
      if credentials is None: raise ValueError('No hcp_credentials specified or found')
      (s3fs_key, s3fs_secret) = to_credentials(credentials)
      if subjects_path is None:
          sdirs = config['hcp_subject_paths']
          subjects_path = next((sd for sd in sdirs if os.path.isdir(sd)), None)
          if subjects_path is None: raise ValueError('No subjects path given or found')
      else: subjects_path = os.path.expanduser(subjects_path)
      # Make sure we can connect to the bucket first...
      fs = s3fs.S3FileSystem(key=s3fs_key, secret=s3fs_secret)
      # Okay, make sure the release is found
      if not fs.exists('/'.join([database, release])):
          raise ValueError('database/release (%s/%s) not found' % (database, release))
      # Check on the subject id to
      sid = to_subject_id(sid)
      hcp_sdir = '/'.join([database, release, str(sid)])
      if not fs.exists(hcp_sdir): raise ValueError('Subject %d not found in release' % sid)
      # Okay, lets download this subject!
      loc_sdir = os.path.join(subjects_path, str(sid))
      # walk through the subject structures
      pulled = []
      for flnm in six.iterkeys(subject_structure['filemap']):
          flnm = flnm.format({'id':sid})
          loc_flnm = os.path.join(loc_sdir, flnm)
          hcp_flnm = '/'.join([hcp_sdir, flnm])
          if not overwrite and os.path.isfile(loc_flnm): continue
          # gotta download it!
          basedir = os.path.split(loc_flnm)[0]
          if not os.path.isdir(basedir): os.makedirs(os.path.abspath(basedir), 0o755)
          fs.get(hcp_flnm, loc_flnm)
          pulled.append(loc_flnm)
      return pulled