def download(sid, credentials=None, subjects_path=None, overwrite=False, release='<STR_LIT>',<EOL>database='<STR_LIT>', file_list=None):
if s3fs is None:<EOL><INDENT>raise RuntimeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if credentials is None: credentials = config['<STR_LIT>']<EOL>if credentials is None: raise ValueError('<STR_LIT>')<EOL>(s3fs_key, s3fs_secret) = to_credentials(credentials)<EOL>if subjects_path is None:<EOL><INDENT>sdirs = config['<STR_LIT>']<EOL>subjects_path = next((sd for sd in sdirs if os.path.isdir(sd)), None)<EOL>if subjects_path is None: raise ValueError('<STR_LIT>')<EOL><DEDENT>else: subjects_path = os.path.expanduser(subjects_path)<EOL>fs = s3fs.S3FileSystem(key=s3fs_key, secret=s3fs_secret)<EOL>if not fs.exists('<STR_LIT:/>'.join([database, release])):<EOL><INDENT>raise ValueError('<STR_LIT>' % (database, release))<EOL><DEDENT>sid = to_subject_id(sid)<EOL>hcp_sdir = '<STR_LIT:/>'.join([database, release, str(sid)])<EOL>if not fs.exists(hcp_sdir): raise ValueError('<STR_LIT>' % sid)<EOL>loc_sdir = os.path.join(subjects_path, str(sid))<EOL>pulled = []<EOL>for flnm in six.iterkeys(subject_structure['<STR_LIT>']):<EOL><INDENT>flnm = flnm.format({'<STR_LIT:id>':sid})<EOL>loc_flnm = os.path.join(loc_sdir, flnm)<EOL>hcp_flnm = '<STR_LIT:/>'.join([hcp_sdir, flnm])<EOL>if not overwrite and os.path.isfile(loc_flnm): continue<EOL>basedir = os.path.split(loc_flnm)[<NUM_LIT:0>]<EOL>if not os.path.isdir(basedir): os.makedirs(os.path.abspath(basedir), <NUM_LIT>)<EOL>fs.get(hcp_flnm, loc_flnm)<EOL>pulled.append(loc_flnm)<EOL><DEDENT>return pulled<EOL>
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.