def _middle_date(date_a, date_b):
    """Returns middle date between date_a and date_b."""
    if date_a > date_b:
        return date_a - ((date_a - date_b) / 2)
    elif date_b > date_a:
        return date_a + ((date_b - date_a) / 2)
    else:
        return date_a