def solve_with_sdpa(sdp, solverparameters=None):
solverexecutable = detect_sdpa(solverparameters)<EOL>if solverexecutable is None:<EOL><INDENT>raise OSError("<STR_LIT>" +<EOL>"<STR_LIT>")<EOL><DEDENT>primal, dual = <NUM_LIT:0>, <NUM_LIT:0><EOL>tempfile_ = tempfile.NamedTemporaryFile()<EOL>tmp_filename = tempfile_.name<EOL>tempfile_.close()<EOL>tmp_dats_filename = tmp_filename + "<STR_LIT>"<EOL>tmp_out_filename = tmp_filename + "<STR_LIT>"<EOL>write_to_sdpa(sdp, tmp_dats_filename)<EOL>command_line = [solverexecutable, "<STR_LIT>", tmp_dats_filename,<EOL>"<STR_LIT>", tmp_out_filename]<EOL>if solverparameters is not None:<EOL><INDENT>for key, value in list(solverparameters.items()):<EOL><INDENT>if key == "<STR_LIT>":<EOL><INDENT>continue<EOL><DEDENT>elif key == "<STR_LIT>":<EOL><INDENT>command_line.extend(["<STR_LIT>", value])<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" + key)<EOL><DEDENT><DEDENT><DEDENT>if sdp.verbose < <NUM_LIT:1>:<EOL><INDENT>with open(os.devnull, "<STR_LIT:w>") as fnull:<EOL><INDENT>call(command_line, stdout=fnull, stderr=fnull)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>call(command_line)<EOL><DEDENT>primal, dual, x_mat, y_mat, status = read_sdpa_out(tmp_out_filename, True,<EOL>True)<EOL>if sdp.verbose < <NUM_LIT:2>:<EOL><INDENT>os.remove(tmp_dats_filename)<EOL>os.remove(tmp_out_filename)<EOL><DEDENT>return primal+sdp.constant_term,dual+sdp.constant_term, x_mat, y_mat, status<EOL>
Helper function to write out the SDP problem to a temporary
    file, call the solver, and parse the output.

    :param sdp: The SDP relaxation to be solved.
    :type sdp: :class:`ncpol2sdpa.sdp`.
    :param solverparameters: Optional parameters to SDPA.
    :type solverparameters: dict of str.
    :returns: tuple of float and list -- the primal and dual solution of the
              SDP, respectively, and a status string.