def search_my_notes(self, loan_id=None, order_id=None, grade=None, portfolio_name=None, status=None, term=None):
assert grade is None or type(grade) is str, '<STR_LIT>'<EOL>assert portfolio_name is None or type(portfolio_name) is str, '<STR_LIT>'<EOL>index = <NUM_LIT:0><EOL>found = []<EOL>sort_by = '<STR_LIT>' if order_id is not None else '<STR_LIT>'<EOL>group_id = order_id if order_id is not None else loan_id   <EOL>if grade is not None:<EOL><INDENT>grade = grade[<NUM_LIT:0>].upper()<EOL><DEDENT>if status is not None:<EOL><INDENT>status = re.sub('<STR_LIT>', '<STR_LIT:U+0020>', status.lower())  <EOL>status = re.sub('<STR_LIT>', '<STR_LIT:U+0020>', status)  <EOL>status = re.sub('<STR_LIT>', '<STR_LIT:->', status.strip())  <EOL>status = re.sub('<STR_LIT>', '<STR_LIT>', status)<EOL><DEDENT>while True:<EOL><INDENT>notes = self.my_notes(start_index=index, sort_by=sort_by)<EOL>if notes['<STR_LIT:result>'] != '<STR_LIT:success>':<EOL><INDENT>break<EOL><DEDENT>if group_id is not None and notes['<STR_LIT>'][<NUM_LIT:0>][sort_by] > group_id:<EOL><INDENT>break<EOL><DEDENT>if group_id is None or notes['<STR_LIT>'][-<NUM_LIT:1>][sort_by] >= group_id:<EOL><INDENT>for note in notes['<STR_LIT>']:<EOL><INDENT>if order_id is not None and note['<STR_LIT>'] != order_id:<EOL><INDENT>continue<EOL><DEDENT>if loan_id is not None and note['<STR_LIT>'] != loan_id:<EOL><INDENT>continue<EOL><DEDENT>if grade is not None and note['<STR_LIT>'][<NUM_LIT:0>] != grade:<EOL><INDENT>continue<EOL><DEDENT>if portfolio_name is not None and note['<STR_LIT>'][<NUM_LIT:0>] != portfolio_name:<EOL><INDENT>continue<EOL><DEDENT>if term is not None and note['<STR_LIT>'] != term:<EOL><INDENT>continue<EOL><DEDENT>if status is not None:<EOL><INDENT>nstatus = re.sub('<STR_LIT>', '<STR_LIT:U+0020>', note['<STR_LIT:status>'].lower())  <EOL>nstatus = re.sub('<STR_LIT>', '<STR_LIT:U+0020>', nstatus)  <EOL>nstatus = re.sub('<STR_LIT>', '<STR_LIT:->', nstatus.strip())  <EOL>nstatus = re.sub('<STR_LIT>', '<STR_LIT>', nstatus)<EOL>if nstatus != status:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>found.append(note)<EOL><DEDENT><DEDENT>index += <NUM_LIT:100><EOL><DEDENT>return found<EOL>
Search for notes you are invested in. Use the parameters to define how to search.
Passing no parameters is the same as calling `my_notes(get_all=True)`

Parameters
----------
loan_id : int, optional
    Search for notes for a specific loan. Since a loan is broken up into a pool of notes, it's possible
    to invest multiple notes in a single loan
order_id : int, optional
    Search for notes from a particular investment order.
grade : {A, B, C, D, E, F, G}, optional
    Match by a particular loan grade
portfolio_name : string, optional
    Search for notes in a portfolio with this name (case sensitive)
status : string, {issued, in-review, in-funding, current, charged-off, late, in-grace-period, fully-paid}, optional
    The funding status string.
term : {60, 36}, optional
    Term length, either 60 or 36 (for 5 year and 3 year, respectively)

Returns
-------
dict
    A dictionary with a list of matching notes on the `loans` key