import requests


def iter_content(response: requests.Response, size):
    """
    Wrap over requests.Response.iter_content
    Return specific amount of data
    """
    buffer = bytearray(size)
    num = 0
    try:
        while num < size:
            content = next(response.iter_content(size - num))
            buffer[num:num + len(content)] = content
            num += len(content)
    except StopIteration:
        raise RuntimeError('Content not long enough')
    return buffer