nodes: 0, module; 1, function_definition; 2, function_name:my_notes; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, while_statement; 15, return_statement; 16, identifier:start_index; 17, integer:0; 18, identifier:limit; 19, integer:100; 20, identifier:get_all; 21, False; 22, identifier:sort_by; 23, string; 24, identifier:sort_dir; 25, string; 26, comment:"""
          Return all the loan notes you've already invested in. By default it'll return 100 results at a time.
  
          Parameters
          ----------
          start_index : int, optional
              The result index to start on. By default only 100 records will be returned at a time, so use this
              to start at a later index in the results. For example, to get results 200 - 300, set `start_index` to 200.
              (default is 0)
          limit : int, optional
              The number of results to return per request. (default is 100)
          get_all : boolean, optional
              Return all results in one request, instead of 100 per request.
          sort_by : string, optional
              What key to sort on
          sort_dir : {'asc', 'desc'}, optional
              Which direction to sort
  
          Returns
          -------
          dict
              A dictionary with a list of matching notes on the `loans` key
          """; 27, assignment; 28, assignment; 29, True; 30, block; 31, identifier:notes; 32, string_content:loanId; 33, string_content:asc; 34, identifier:index; 35, identifier:start_index; 36, identifier:notes; 37, dictionary; 38, expression_statement; 39, expression_statement; 40, expression_statement; 41, comment:# Notes returned; 42, if_statement; 43, comment:# Load more; 44, if_statement; 45, pair; 46, pair; 47, pair; 48, assignment; 49, assignment; 50, assignment; 51, call; 52, block; 53, comment:# Error; 54, else_clause; 55, boolean_operator; 56, block; 57, comment:# End; 58, else_clause; 59, string; 60, list; 61, string; 62, integer:0; 63, string; 64, string; 65, identifier:payload; 66, dictionary; 67, identifier:response; 68, call; 69, identifier:json_response; 70, call; 71, attribute; 72, argument_list; 73, expression_statement; 74, expression_statement; 75, block; 76, comparison_operator:get_all is True; 77, comparison_operator:len(notes['loans']) < notes['total']; 78, expression_statement; 79, block; 80, string_content:loans; 81, string_content:total; 82, string_content:result; 83, string_content:success; 84, pair; 85, pair; 86, pair; 87, pair; 88, pair; 89, attribute; 90, argument_list; 91, attribute; 92, argument_list; 93, attribute; 94, identifier:json_success; 95, identifier:json_response; 96, augmented_assignment; 97, assignment; 98, expression_statement; 99, break_statement; 100, identifier:get_all; 101, True; 102, call; 103, subscript; 104, augmented_assignment; 105, break_statement; 106, string; 107, identifier:sort_by; 108, string; 109, identifier:sort_dir; 110, string; 111, identifier:index; 112, string; 113, identifier:limit; 114, string; 115, string; 116, attribute; 117, identifier:post; 118, string; 119, keyword_argument; 120, identifier:response; 121, identifier:json; 122, identifier:self; 123, identifier:session; 124, subscript; 125, subscript; 126, subscript; 127, subscript; 128, assignment; 129, identifier:len; 130, argument_list; 131, identifier:notes; 132, string; 133, identifier:index; 134, identifier:limit; 135, string_content:sortBy; 136, string_content:dir; 137, string_content:startindex; 138, string_content:pagesize; 139, string_content:namespace; 140, string_content:/account; 141, identifier:self; 142, identifier:session; 143, string_content:/account/loansAj.action; 144, identifier:data; 145, identifier:payload; 146, identifier:notes; 147, string; 148, subscript; 149, string; 150, identifier:notes; 151, string; 152, subscript; 153, string; 154, subscript; 155, subscript; 156, subscript; 157, string_content:total; 158, string_content:loans; 159, identifier:json_response; 160, string; 161, string_content:loans; 162, string_content:total; 163, identifier:json_response; 164, string; 165, string_content:totalRecords; 166, identifier:notes; 167, string; 168, identifier:json_response; 169, string; 170, identifier:notes; 171, string; 172, string_content:searchresult; 173, string_content:searchresult; 174, string_content:result; 175, string_content:result; 176, string_content:loans
code: def my_notes(self, start_index=0, limit=100, get_all=False, sort_by='loanId', sort_dir='asc'):
          """
          Return all the loan notes you've already invested in. By default it'll return 100 results at a time.
  
          Parameters
          ----------
          start_index : int, optional
              The result index to start on. By default only 100 records will be returned at a time, so use this
              to start at a later index in the results. For example, to get results 200 - 300, set `start_index` to 200.
              (default is 0)
          limit : int, optional
              The number of results to return per request. (default is 100)
          get_all : boolean, optional
              Return all results in one request, instead of 100 per request.
          sort_by : string, optional
              What key to sort on
          sort_dir : {'asc', 'desc'}, optional
              Which direction to sort
  
          Returns
          -------
          dict
              A dictionary with a list of matching notes on the `loans` key
          """
  
          index = start_index
          notes = {
              'loans': [],
              'total': 0,
              'result': 'success'
          }
          while True:
              payload = {
                  'sortBy': sort_by,
                  'dir': sort_dir,
                  'startindex': index,
                  'pagesize': limit,
                  'namespace': '/account'
              }
              response = self.session.post('/account/loansAj.action', data=payload)
              json_response = response.json()
  
              # Notes returned
              if self.session.json_success(json_response):
                  notes['loans'] += json_response['searchresult']['loans']
                  notes['total'] = json_response['searchresult']['totalRecords']
  
              # Error
              else:
                  notes['result'] = json_response['result']
                  break
  
              # Load more
              if get_all is True and len(notes['loans']) < notes['total']:
                  index += limit
  
              # End
              else:
                  break
  
          return notes