import re


def parse_exception_message(exc):
    """
    Parses the message embedded in an exception and returns the standard output and error
    if it can be found.

    @param      exc     exception coming from @see fn run_cmd
    @return             out, err
    """
    mes = str(exc)
    reg = re.compile(".*#---OUT---#(.*)#---ERR---#(.*)", re.DOTALL)
    find = reg.search(mes.replace("\r", ""))
    if find:  # pragma: no cover
        gr = find.groups()
        out, err = gr[0], gr[1]
        return out.strip("\n "), err.strip("\n ")
    else:
        return None, None