def getElection(pk): queryset = Election.get_by_uuid(pk) if (queryset): return queryset queryset = Election.get_by_short_name(pk) if (queryset): return queryset raise_exception(404, 'Election not Found.')