def _read_exact(read, size):
    """
    Read exactly size bytes with `read`, except on EOF

    :Parameters:
     - `read`: The reading function
     - `size`: expected number of bytes

    :Types:
     - `read`: ``callable``
     - `size`: ``int``

    :return: The read bytes
    :rtype: ``str``
    """
    if size < 0:
        return read(size)
    vlen, buf = 0, []
    push = buf.append
    while vlen < size:
        val = read(size - vlen)
        if not val:
            break
        vlen += len(val)
        push(val)
    return "".join(buf)