def validate_one(self, loan):
assert type(loan) is dict, '<STR_LIT>'<EOL>req = {<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>}<EOL>for key, criteria in req.iteritems():<EOL><INDENT>if criteria in self and key not in loan:<EOL><INDENT>raise FilterValidationError('<STR_LIT>'.format(key), loan, criteria)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in self:<EOL><INDENT>loan_ids = str(self['<STR_LIT>']).split('<STR_LIT:U+002C>')<EOL>if str(loan['<STR_LIT>']) not in loan_ids:<EOL><INDENT>raise FilterValidationError('<STR_LIT>'.format(loan['<STR_LIT>'], self['<STR_LIT>']), loan=loan, criteria='<STR_LIT>')<EOL><DEDENT><DEDENT>grade = loan['<STR_LIT>'][<NUM_LIT:0>]  <EOL>if '<STR_LIT>' in self and self['<STR_LIT>']['<STR_LIT>'] is not True:<EOL><INDENT>if grade not in self['<STR_LIT>']:<EOL><INDENT>raise FilterValidationError('<STR_LIT>'.format(grade), loan, '<STR_LIT>')<EOL><DEDENT>elif self['<STR_LIT>'][grade] is False:<EOL><INDENT>raise FilterValidationError(loan=loan, criteria='<STR_LIT>')<EOL><DEDENT><DEDENT>if '<STR_LIT>' in self and self['<STR_LIT>'] is not None:<EOL><INDENT>if loan['<STR_LIT>'] == <NUM_LIT> and self['<STR_LIT>']['<STR_LIT>'] is False:<EOL><INDENT>raise FilterValidationError(loan=loan, criteria='<STR_LIT>')<EOL><DEDENT>elif loan['<STR_LIT>'] == <NUM_LIT> and self['<STR_LIT>']['<STR_LIT>'] is False:<EOL><INDENT>raise FilterValidationError(loan=loan, criteria='<STR_LIT>')<EOL><DEDENT><DEDENT>if '<STR_LIT>' in self:<EOL><INDENT>loan_progress = (<NUM_LIT:1> - (loan['<STR_LIT>'] / loan['<STR_LIT>'])) * <NUM_LIT:100><EOL>if self['<STR_LIT>'] > loan_progress:<EOL><INDENT>raise FilterValidationError(loan=loan, criteria='<STR_LIT>')<EOL><DEDENT><DEDENT>if '<STR_LIT>' in self:<EOL><INDENT>if self['<STR_LIT>'] is True and loan['<STR_LIT>'] is True:<EOL><INDENT>raise FilterValidationError(loan=loan, criteria='<STR_LIT>')<EOL><DEDENT><DEDENT>if '<STR_LIT>' in self and loan['<STR_LIT>'] is not False:<EOL><INDENT>purpose = self['<STR_LIT>']<EOL>if type(purpose) is not dict:<EOL><INDENT>purpose = {purpose: True}<EOL><DEDENT>if '<STR_LIT>' not in purpose or purpose['<STR_LIT>'] is False:<EOL><INDENT>if loan['<STR_LIT>'] not in purpose:<EOL><INDENT>raise FilterValidationError(loan=loan, criteria='<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>return True<EOL>
Validate a single loan result record against the filters

Parameters
----------
loan : dict
    A single loan note record

Returns
-------
boolean
    True or raises FilterValidationError

Raises
------
FilterValidationError
    If the loan does not match the filter criteria