def _sam_readline(sock):
    """
    read a line from a sam control socket
    """
    response = bytearray()
    while True:
        c = sock.recv(1)
        if c:
            if c == b'\n':
                break
            response += c
        else:
            break
    return response.decode('ascii')