def METHOD_NAME(kwargs):
    """
    This function is to get all candidates from candidate_history
    """
    candidate = (
        db.session.query(
            CandidateHistory.candidate_id.label('candidate_id'),
            CandidateHistory.two_year_period.label('two_year_period'),
            CandidateHistory.candidate_election_year.label('candidate_election_year'),
        )
        .filter(
            (
                CandidateHistory.candidate_id.in_(kwargs.get('candidate_id'))
                if kwargs.get('candidate_id')
                else True
            )
        )
        .distinct()
        .subquery()
    )
    cycle_column = (
        candidate.c.candidate_election_year + candidate.c.candidate_election_year % 2
        if kwargs.get('election_full')
        else candidate.c.two_year_period
    ).label('cycle')
    return cycle_column, candidate