import requests


def _download_chunk(args):
    """Download a single chunk.

    :param args: Tuple consisting of (url, start, finish) with start and finish being byte offsets.
    :return: Tuple of chunk id and chunk data
    """
    idx, args = args
    url, start, finish = args
    range_string = '{}-'.format(start)

    if finish is not None:
        range_string += str(finish)

    response = requests.get(url, headers={'Range': 'bytes=' + range_string})  # Actual HTTP get download request
    return idx, response.content