def filter_by_phd_year(lattesframe, year0, year1):
    """Returns the rows of the researchers in arg lattesframe that have
    concluded their PhD program between args year0 and year1.
    Args:
        lattesframe: the pandas dataframe to be filtered.
        year0: the first year of the interval.
        year1: the last year of the interval.
    """
    if year0 > year1:
        dummy = year0
        year0 = year1
        year1 = dummy

    return lattesframe[(lattesframe['anoPrimeiroD'] >= year0) &
                       (lattesframe['anoPrimeiroD'] <= year1)]