def recvn(sock, n):
    """
    Read n bytes from a socket
    
    Parameters
    ----------
    sock - socket.socket
        The socket to read from
    n - int
        The number of bytes to read
    """
    ret = b''
    read_length = 0
    while read_length < n:
        tmp = sock.recv(n - read_length)
        
        if len(tmp)==0:
            return ret
        
        ret += tmp
        read_length += len(tmp)
    
    if read_length != n:
        raise #"Low level Network ERROR: "
    
    return ret