<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def create_frames(self, channel_id, buf, frame_max):
        '''
        A generator which will create frames from a buffer given a max
        frame size.
        '''
        size = frame_max - 8   # 8 bytes overhead for frame header and footer
        offset = 0
        while True:
            payload = buf[offset:(offset + size)]
            if len(payload) == 0:
                break
            offset += size

            yield ContentFrame(channel_id, payload)
            if offset >= len(buf):
                break