def qualities(quality_ids):
 def q(qid):
  try:
   return quality_ids.index(qid)
  except ValueError:
   return (-1)
 return q

def qualities ( quality_ids ) : def q ( qid ) : try : return quality_ids . index ( qid ) except ValueError : return ( - 1 ) return q
get a numeric quality value out of a list of possible values .