def conditionally_add_query_item(query, item, condition):
 condition = condition.lower()
 if (condition == 'yes'):
  return (query & Q(item, 'eq', True))
 elif (condition == 'no'):
  return (query & Q(item, 'eq', False))
 elif (condition == 'either'):
  return query
 raise HTTPError(http.BAD_REQUEST)

def conditionally_add_query_item ( query , item , condition ) : condition = condition . lower ( ) if ( condition == 'yes' ) : return ( query & Q ( item , 'eq' , True ) ) elif ( condition == 'no' ) : return ( query & Q ( item , 'eq' , False ) ) elif ( condition == 'either' ) : return query raise HTTPError ( http . BAD_REQUEST )
helper for the search_projects_by_title function which will add a condition to a query it will give an error if the proper search term is not used .