<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _receive_all(socket, num_bytes):
 """Reads `num_bytes` bytes from the specified socket. :param socket: open socket instance :param num_bytes: number of bytes to read :return: received data """


    buffer = ''
    buffer_size = 0
    bytes_left = num_bytes
    while buffer_size < num_bytes:
        data = socket.recv(bytes_left)
        delta = len(data)
        buffer_size += delta
        bytes_left -= delta
        buffer += data
    return buffer