def order(replay1, replay2):
    """
    An ordered tuple of the given replays. The first element is the earlier
    replay, and the second element is the later replay.

    Parameters
    ----------
    replay1: Replay
        The first replay to order.
    replay2: Replay
        The second replay to order.

    Returns
    -------
    (Replay, Replay)
        The first element is the earlier replay, and the second element is the
        later replay.
    """
    if not replay1.timestamp or not replay2.timestamp:
        raise ValueError("Both replay1 and replay2 must provide a timestamp. "
            "Replays without a timestamp cannot be ordered.")
    # assume they're passed in order (earliest first); if not, switch them
    order = (replay1, replay2)
    if replay2.timestamp < replay1.timestamp:
        order = tuple(reversed(order))
    return order