<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_for_status(self, r):
 """Given a response, raise for bad status for certain actions Some redcap api methods don't return error messages that the user could test for or otherwise use. Therefore, we need to do the testing ourself Raising for everything wouldn't let the user see the (hopefully helpful) error message"""

        if self.type in ('metadata', 'exp_file', 'imp_file', 'del_file'):
            r.raise_for_status()
        # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
        # specifically 10.5
        if 500 <= r.status_code < 600:
            raise RedcapError(r.content)