<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sam_cmd(sock, line, parse=True):
 """Send a line to the SAM controller, returning the parsed response"""

    sam_send(sock, line)
    reply_line = sam_readline(sock)
    if parse:
        return sam_parse_reply(reply_line)
    else:
        return reply_line