

def parse_content_range(content_range, resumed_from):
    '\n    Parse and validate Content-Range header.\n\n    <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>\n\n    :param content_range: the value of a Content-Range response header\n                          eg. "bytes 21010-47021/47022"\n    :param resumed_from: first byte pos. from the Range request header\n    :return: total size of the response body when fully downloaded.\n\n    '
    if (content_range is None):
        raise ContentRangeError('Missing Content-Range')
    pattern = '^bytes (?P<first_byte_pos>\\d+)-(?P<last_byte_pos>\\d+)/(\\*|(?P<instance_length>\\d+))$'
    match = re.match(pattern, content_range)
    if (not match):
        raise ContentRangeError(('Invalid Content-Range format %r' % content_range))
    content_range_dict = match.groupdict()
    first_byte_pos = int(content_range_dict['first_byte_pos'])
    last_byte_pos = int(content_range_dict['last_byte_pos'])
    instance_length = (int(content_range_dict['instance_length']) if content_range_dict['instance_length'] else None)
    if ((content_range_dict >= last_byte_pos) or ((instance_length is not None) and (instance_length <= last_byte_pos))):
        raise ContentRangeError(('Invalid Content-Range returned: %r' % content_range))
    if ((first_byte_pos != resumed_from) or ((instance_length is not None) and ((last_byte_pos + 1) != instance_length))):
        raise ContentRangeError(('Unexpected Content-Range returned (%r) for the requested Range ("bytes=%d-")' % (content_range, resumed_from)))
    return (last_byte_pos + 1)

dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/httpie/downloads.py parse_content_range/VarMisuse@114/391 `first_byte_pos`->`content_range_dict`