<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _raise_fail(self, response, expected):
 """ Raise a TestStepFail with neatly formatted error message """

        try:
            if self.logger:
                self.logger.error("Status code "
                                  "{} != {}. \n\n "
                                  "Payload: {}".format(response.status_code,
                                                       expected,
                                                       response.content))
            raise TestStepFail("Status code {} != {}.".format(response.status_code, expected))
        except TestStepFail:
            raise
        except:  # pylint: disable=bare-except
            if self.logger:
                self.logger.error("Status code "
                                  "{} != {}. \n\n "
                                  "Payload: {}".format(response.status_code,
                                                       expected,
                                                       "Unable to parse payload"))
            raise TestStepFail("Status code {} != {}.".format(response.status_code, expected))