def reverse_rows(rows):
    """
    Given a list of AGP rows, return a new set of rows assembling
    the reverse complement of the input rows.

    Args:
        rows (list): an ordered list of AgpRow objects

    Returns:
        reverse_chromosome_rows (list): the input, except in reverse
            order, with the rows modified to be reverse-complements
    """
    # first, get the first and last part numbers and the start and end
    # position of the entire segment being flipped so we can count
    # backwards from there.
    first_part_number = rows[0].part_number
    last_part_number = rows[-1].part_number
    first_part_start = rows[0].object_beg
    last_part_end = rows[-1].object_end

    reversed_rows = []
    for row in reversed(rows):
        new_start = first_part_start + last_part_end - row.object_end
        new_end = first_part_start + last_part_end - row.object_beg
        row.object_beg, row.object_end = new_start, new_end

        row.part_number = first_part_number + last_part_number - row.part_number

        if not row.is_gap:
            if row.orientation == "+":
                row.orientation = "-"
            elif row.orientation == "-":
                row.orientation = "+"
            # if the orientation is something else, leave it be

        reversed_rows.append(row)

    return reversed_rows