<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stderr_cm(self):
 """ Redirect the stderr to a log file. """

        with open(self._get_stderr_log(), 'a+') as fh:
            msg = '### {} ###\n'.format(self._datetime)
            fh.write(msg)
            fh.flush()

            try:
                yield fh
            except Exception as e:
                self._has_error = True
                fh.write(e.message)
                fh.flush()
                raise