def parse_time_division(self, bytes):
        """Parse the time division found in the header of a MIDI file and
        return a dictionary with the boolean fps set to indicate whether to
        use frames per second or ticks per beat.

        If fps is True, the values SMPTE_frames and clock_ticks will also be
        set. If fps is False, ticks_per_beat will hold the value.
        """
        # If highest bit is set, time division is set in frames per second
        # otherwise in ticks_per_beat
        value = self.bytes_to_int(bytes)
        if not value & 0x8000:
            return {'fps': False, 'ticks_per_beat': value & 0x7FFF}
        else:
            SMPTE_frames = (value & 0x7F00) >> 2
            if SMPTE_frames not in [24, 25, 29, 30]:
                raise TimeDivisionError, \
                    "'%d' is not a valid value for the number of SMPTE frames"\
                     % SMPTE_frames
            clock_ticks = (value & 0x00FF) >> 2
            return {'fps': True, 'SMPTE_frames': SMPTE_frames,
                    'clock_ticks': clock_ticks}
Parse the time division found in the header of a MIDI file and
        return a dictionary with the boolean fps set to indicate whether to
        use frames per second or ticks per beat.

        If fps is True, the values SMPTE_frames and clock_ticks will also be
        set. If fps is False, ticks_per_beat will hold the value.