def compare_evrs(evr_a, evr_b):
a_epoch, a_ver, a_rel = evr_a<EOL>b_epoch, b_ver, b_rel = evr_b<EOL>if a_epoch != b_epoch:<EOL><INDENT>return a_newer if a_epoch > b_epoch else b_newer<EOL><DEDENT>ver_comp = compare_versions(a_ver, b_ver)<EOL>if ver_comp != a_eq_b:<EOL><INDENT>return ver_comp<EOL><DEDENT>rel_comp = compare_versions(a_rel, b_rel)<EOL>return rel_comp<EOL>
Compare two EVR tuples to determine which is newer

    This method compares the epoch, version, and release of the
    provided package strings, assuming that epoch is 0 if not provided.
    Comparison is performed on the epoch, then the version, and then
    the release. If at any point a non-equality is found, the result is
    returned without any remaining comparisons being performed (e.g. if
    the epochs of the packages differ, the versions are releases are
    not compared).

    :param tuple evr_a: an EVR tuple
    :param tuple evr_b: an EVR tuple