def eligibility_constraint_for(self, user_type):
    if not self.eligibility:
      return []

    # constraints that are relevant
    relevant_constraints = [constraint['constraint'] for constraint in self.eligibility if constraint['auth_system'] == user_type and constraint.has_key('constraint')]
    if len(relevant_constraints) > 0:
      return relevant_constraints[0]
    else:
      return []
dataset/ETHPy150Open benadida/helios-server/helios/models.py/Election.eligibility_constraint_for/original