code: def _read_track(chunk):
      
  
      TEMPO, MIDI = range(2)
  
      # Deviations: The running status should be reset on non midi events, but
      # some files contain meta events inbetween.
      # TODO: Offset and time signature are not considered.
  
      tempos = []
      events = []
  
      chunk = bytearray(chunk)
      deltasum = 0
      status = 0
      off = 0
      while off < len(chunk):
          delta, off = _var_int(chunk, off)
          deltasum += delta
          event_type = chunk[off]
          off += 1
          if event_type == 0xFF:
              meta_type = chunk[off]
              off += 1
              num, off = _var_int(chunk, off)
              # TODO: support offset/time signature
              if meta_type == 0x51:
                  data = chunk[off:off + num]
                  if len(data) != 3:
                      raise SMFError
                  tempo = struct.unpack(">I", b"\x00" + bytes(data))[0]
                  tempos.append((deltasum, TEMPO, tempo))
              off += num
          elif event_type in (0xF0, 0xF7):
              val, off = _var_int(chunk, off)
              off += val
          else:
              if event_type < 0x80:
                  # if < 0x80 take the type from the previous midi event
                  off += 1
                  event_type = status
              elif event_type < 0xF0:
                  off += 2
                  status = event_type
              else:
                  raise SMFError("invalid event")
  
              if event_type >> 4 in (0xD, 0xC):
                  off -= 1
  
              events.append((deltasum, MIDI, delta))
  
      return events, tempos
docs: Retuns a list of midi events and tempo change events