'Upload media, chunked append.'

def upload_media_chunked(self, file, total_bytes, media_id):

    segment_id = 0
    bytes_sent = 0
    while (bytes_sent < total_bytes):
        chunk = file.read(((4 * 1024) * 1024))
        resp = self.upload_media_append(chunk, media_id, segment_id)
        if (resp.status_code not in range(200, 299)):
            self.log_error_resp_append(resp)
            return None
        segment_id = (segment_id + 1)
        bytes_sent = file.tell()
        self.log_bytes_sent(bytes_sent, total_bytes)
    return media_id
