def upload_chunk(chunk, upload_parameters):
    """
    Handles the POST request needed to upload a single portion of the video file.
    Serves as a helper method for upload_by_multipart().
    The offset used to determine where a chunk begins and ends is updated in the course of
    this method's execution.

    :param chunk: <byte[]> the raw bytes of data from the video file
    :param upload_parameters: <dict> a collection of all pieces of info needed to upload the video
    """
    begin_chunk = upload_parameters['chunk_offset']

    # The next chunk will begin at (begin_chunk + len(chunk)), so the -1 ensures that the ranges do not overlap
    end_chunk = begin_chunk + len(chunk) - 1
    file_size = upload_parameters['file_size']
    filename = upload_parameters['file_size']
    logging.info("begin_chunk / end_chunk = {} / {}".format(begin_chunk, end_chunk))

    upload_parameters['headers'].update(
        {
            'X-Content-Range': 'bytes {}-{}/{}'.format(begin_chunk, end_chunk, file_size),
            'Content-Disposition': 'attachment; filename="{}"'.format(filename),
            'Content-Type': 'application/octet-stream',
            'Content-Length': str((end_chunk - begin_chunk) + 1)
        }
    )

    response = requests.post(
        upload_parameters['upload_url'],
        params=upload_parameters['query_parameters'],
        headers=upload_parameters['headers'],
        data=chunk
    )
    response.raise_for_status()

    # As noted before, the next chunk begins at (begin_chunk + len(chunk))
    upload_parameters['chunk_offset'] = begin_chunk + len(chunk)
Handles the POST request needed to upload a single portion of the video file.
    Serves as a helper method for upload_by_multipart().
    The offset used to determine where a chunk begins and ends is updated in the course of
    this method's execution.

    :param chunk: <byte[]> the raw bytes of data from the video file
    :param upload_parameters: <dict> a collection of all pieces of info needed to upload the video