nodes: 0, module; 1, function_definition; 2, function_name:download; 3, parameters; 4, block; 5, identifier:directory; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, expression_statement; 18, expression_statement; 19, if_statement; 20, expression_statement; 21, expression_statement; 22, if_statement; 23, if_statement; 24, if_statement; 25, identifier:master_token; 26, None; 27, identifier:member; 28, None; 29, identifier:access_token; 30, None; 31, identifier:source; 32, None; 33, identifier:project_data; 34, False; 35, identifier:max_size; 36, string; 37, identifier:verbose; 38, False; 39, identifier:debug; 40, False; 41, identifier:memberlist; 42, None; 43, identifier:excludelist; 44, None; 45, identifier:id_filename; 46, False; 47, comment:"""
      Download data from project members to the target directory.
  
      Unless this is a member-specific download, directories will be
      created for each project member ID. Also, unless a source is specified,
      all shared sources are downloaded and data is sorted into subdirectories
      according to source.
  
      Projects can optionally return data to Open Humans member accounts.
      If project_data is True (or the "--project-data" flag is used), this data
      (the project's own data files, instead of data from other sources) will be
      downloaded for each member.
  
      :param directory: This field is the target directory to download data.
      :param master_token: This field is the master access token for the project.
          It's default value is None.
      :param member: This field is specific member whose project data is
          downloaded. It's default value is None.
      :param access_token: This field is the user specific access token. It's
          default value is None.
      :param source: This field is the data source. It's default value is None.
      :param project_data: This field is data related to particular project. It's
          default value is False.
      :param max_size: This field is the maximum file size. It's default value is
          128m.
      :param verbose: This boolean field is the logging level. It's default value
          is False.
      :param debug: This boolean field is the logging level. It's default value
          is False.
      :param memberlist: This field is list of members whose data will be
          downloaded. It's default value is None.
      :param excludelist: This field is list of members whose data will be
          skipped. It's default value is None.
      """; 48, call; 49, boolean_operator; 50, block; 51, assignment; 52, assignment; 53, boolean_operator; 54, block; 55, parenthesized_expression; 56, block; 57, identifier:master_token; 58, block; 59, else_clause; 60, string_content:128m; 61, identifier:set_log_level; 62, argument_list; 63, parenthesized_expression; 64, parenthesized_expression; 65, raise_statement; 66, identifier:memberlist; 67, call; 68, identifier:excludelist; 69, call; 70, not_operator; 71, parenthesized_expression; 72, raise_statement; 73, boolean_operator; 74, raise_statement; 75, expression_statement; 76, if_statement; 77, block; 78, identifier:debug; 79, identifier:verbose; 80, boolean_operator; 81, boolean_operator; 82, call; 83, identifier:read_id_list; 84, argument_list; 85, identifier:read_id_list; 86, argument_list; 87, parenthesized_expression; 88, boolean_operator; 89, call; 90, identifier:source; 91, identifier:project_data; 92, call; 93, assignment; 94, identifier:member; 95, block; 96, else_clause; 97, expression_statement; 98, if_statement; 99, identifier:memberlist; 100, identifier:excludelist; 101, identifier:member; 102, identifier:access_token; 103, identifier:UsageError; 104, argument_list; 105, identifier:memberlist; 106, identifier:excludelist; 107, boolean_operator; 108, identifier:master_token; 109, identifier:access_token; 110, identifier:UsageError; 111, argument_list; 112, identifier:UsageError; 113, argument_list; 114, identifier:project; 115, call; 116, if_statement; 117, block; 118, assignment; 119, identifier:project_data; 120, block; 121, else_clause; 122, concatenated_string; 123, identifier:master_token; 124, identifier:access_token; 125, concatenated_string; 126, concatenated_string; 127, identifier:OHProject; 128, argument_list; 129, identifier:project_data; 130, block; 131, else_clause; 132, expression_statement; 133, identifier:member_data; 134, call; 135, expression_statement; 136, block; 137, string; 138, string; 139, string; 140, string; 141, string:"It doesn't make sense to use both 'source' and"; 142, string:"'project-data' options!"; 143, keyword_argument; 144, expression_statement; 145, block; 146, call; 147, identifier:exchange_oauth2_member; 148, argument_list; 149, call; 150, expression_statement; 151, string_content:Please do not provide a memberlist or excludelist; 152, string_content:when retrieving data for a single member.; 153, string_content:Please specify either a master access token (-T),; 154, string_content:or an OAuth2 user access token (-t).; 155, identifier:master_access_token; 156, identifier:master_token; 157, call; 158, expression_statement; 159, attribute; 160, argument_list; 161, identifier:access_token; 162, keyword_argument; 163, attribute; 164, argument_list; 165, call; 166, attribute; 167, argument_list; 168, call; 169, identifier:project; 170, identifier:download_all; 171, keyword_argument; 172, keyword_argument; 173, keyword_argument; 174, keyword_argument; 175, keyword_argument; 176, keyword_argument; 177, keyword_argument; 178, identifier:all_files; 179, True; 180, identifier:OHProject; 181, identifier:download_member_project_data; 182, keyword_argument; 183, keyword_argument; 184, keyword_argument; 185, keyword_argument; 186, attribute; 187, argument_list; 188, identifier:project; 189, identifier:download_member_project_data; 190, keyword_argument; 191, keyword_argument; 192, keyword_argument; 193, keyword_argument; 194, attribute; 195, argument_list; 196, identifier:target_dir; 197, identifier:directory; 198, identifier:source; 199, identifier:source; 200, identifier:max_size; 201, identifier:max_size; 202, identifier:memberlist; 203, identifier:memberlist; 204, identifier:excludelist; 205, identifier:excludelist; 206, identifier:project_data; 207, identifier:project_data; 208, identifier:id_filename; 209, identifier:id_filename; 210, identifier:member_data; 211, identifier:member_data; 212, identifier:target_member_dir; 213, identifier:directory; 214, identifier:max_size; 215, identifier:max_size; 216, identifier:id_filename; 217, identifier:id_filename; 218, identifier:OHProject; 219, identifier:download_member_shared; 220, keyword_argument; 221, keyword_argument; 222, keyword_argument; 223, keyword_argument; 224, keyword_argument; 225, identifier:member_data; 226, subscript; 227, identifier:target_member_dir; 228, identifier:directory; 229, identifier:max_size; 230, identifier:max_size; 231, identifier:id_filename; 232, identifier:id_filename; 233, identifier:project; 234, identifier:download_member_shared; 235, keyword_argument; 236, keyword_argument; 237, keyword_argument; 238, keyword_argument; 239, keyword_argument; 240, identifier:member_data; 241, identifier:member_data; 242, identifier:target_member_dir; 243, identifier:directory; 244, identifier:source; 245, identifier:source; 246, identifier:max_size; 247, identifier:max_size; 248, identifier:id_filename; 249, identifier:id_filename; 250, attribute; 251, identifier:member; 252, identifier:member_data; 253, subscript; 254, identifier:target_member_dir; 255, identifier:directory; 256, identifier:source; 257, identifier:source; 258, identifier:max_size; 259, identifier:max_size; 260, identifier:id_filename; 261, identifier:id_filename; 262, identifier:project; 263, identifier:project_data; 264, attribute; 265, identifier:member; 266, identifier:project; 267, identifier:project_data
code: def download(directory, master_token=None, member=None, access_token=None,
               source=None, project_data=False, max_size='128m', verbose=False,
               debug=False, memberlist=None, excludelist=None,
               id_filename=False):
      """
      Download data from project members to the target directory.
  
      Unless this is a member-specific download, directories will be
      created for each project member ID. Also, unless a source is specified,
      all shared sources are downloaded and data is sorted into subdirectories
      according to source.
  
      Projects can optionally return data to Open Humans member accounts.
      If project_data is True (or the "--project-data" flag is used), this data
      (the project's own data files, instead of data from other sources) will be
      downloaded for each member.
  
      :param directory: This field is the target directory to download data.
      :param master_token: This field is the master access token for the project.
          It's default value is None.
      :param member: This field is specific member whose project data is
          downloaded. It's default value is None.
      :param access_token: This field is the user specific access token. It's
          default value is None.
      :param source: This field is the data source. It's default value is None.
      :param project_data: This field is data related to particular project. It's
          default value is False.
      :param max_size: This field is the maximum file size. It's default value is
          128m.
      :param verbose: This boolean field is the logging level. It's default value
          is False.
      :param debug: This boolean field is the logging level. It's default value
          is False.
      :param memberlist: This field is list of members whose data will be
          downloaded. It's default value is None.
      :param excludelist: This field is list of members whose data will be
          skipped. It's default value is None.
      """
      set_log_level(debug, verbose)
  
      if (memberlist or excludelist) and (member or access_token):
          raise UsageError('Please do not provide a memberlist or excludelist '
                           'when retrieving data for a single member.')
      memberlist = read_id_list(memberlist)
      excludelist = read_id_list(excludelist)
      if not (master_token or access_token) or (master_token and access_token):
          raise UsageError('Please specify either a master access token (-T), '
                           'or an OAuth2 user access token (-t).')
      if (source and project_data):
          raise UsageError("It doesn't make sense to use both 'source' and"
                           "'project-data' options!")
  
      if master_token:
          project = OHProject(master_access_token=master_token)
          if member:
              if project_data:
                  project.download_member_project_data(
                      member_data=project.project_data[member],
                      target_member_dir=directory,
                      max_size=max_size,
                      id_filename=id_filename)
              else:
                  project.download_member_shared(
                      member_data=project.project_data[member],
                      target_member_dir=directory,
                      source=source,
                      max_size=max_size,
                      id_filename=id_filename)
          else:
              project.download_all(target_dir=directory,
                                   source=source,
                                   max_size=max_size,
                                   memberlist=memberlist,
                                   excludelist=excludelist,
                                   project_data=project_data,
                                   id_filename=id_filename)
      else:
          member_data = exchange_oauth2_member(access_token, all_files=True)
          if project_data:
              OHProject.download_member_project_data(member_data=member_data,
                                                     target_member_dir=directory,
                                                     max_size=max_size,
                                                     id_filename=id_filename)
          else:
              OHProject.download_member_shared(member_data=member_data,
                                               target_member_dir=directory,
                                               source=source,
                                               max_size=max_size,
                                               id_filename=id_filename)