def _output(msg, outfile=None):
    """output the msg to outfile if outfile is specified, otherwise, return the msg."""
    if outfile:
        outfile.write(msg)
        return ""
    else:
        return msg