code: def validate_time_inversion(self):
          
  
          if not self.is_set():
              # for python2/3 compatibility
              raise TypeError
  
          if self.start_datetime > self.end_datetime:
              raise ValueError(
                  "time inversion found: {:s} > {:s}".format(
                      str(self.start_datetime), str(self.end_datetime)
                  )
              )
docs: Check time inversion of the time range.
  
          :raises ValueError:
              If |attr_start_datetime| is
              bigger than |attr_end_datetime|.
          :raises TypeError:
              Any one of |attr_start_datetime| and |attr_end_datetime|,
              or both is inappropriate datetime value.
  
          :Sample Code:
              .. code:: python
  
                  from datetimerange import DateTimeRange
                  time_range = DateTimeRange("2015-03-22T10:10:00+0900", "2015-03-22T10:00:00+0900")
                  try:
                      time_range.validate_time_inversion()
                  except ValueError:
                      print "time inversion"
          :Output:
              .. parsed-literal::
  
                  time inversion