def adapt_criterion_to_null(crit, nulls):
 def visit_binary(binary):
  if (isinstance(binary.left, BindParameter) and (binary.left._identifying_key in nulls)):
   binary.left = binary.right
   binary.right = Null()
   binary.operator = operators.is_
   binary.negate = operators.isnot
  elif (isinstance(binary.right, BindParameter) and (binary.right._identifying_key in nulls)):
   binary.right = Null()
   binary.operator = operators.is_
   binary.negate = operators.isnot
 return visitors.cloned_traverse(crit, {}, {'binary': visit_binary})

def adapt_criterion_to_null ( crit , nulls ) : def visit_binary ( binary ) : if ( isinstance ( binary . left , BindParameter ) and ( binary . left . _identifying_key in nulls ) ) : binary . left = binary . right binary . right = Null ( ) binary . operator = operators . is_ binary . negate = operators . isnot elif ( isinstance ( binary . right , BindParameter ) and ( binary . right . _identifying_key in nulls ) ) : binary . right = Null ( ) binary . operator = operators . is_ binary . negate = operators . isnot return visitors . cloned_traverse ( crit , { } , { 'binary' : visit_binary } )
given criterion containing bind params .