<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def body_kwargs(self):
 """ the request body, if this is a POST request this tries to do the right thing with the body, so if you have set the body and the content type is json, then it will return the body json decoded, if you need the original string body, use body example -- self.body = '{"foo":{"name":"bar"}}' b = self.body_kwargs # dict with: {"foo": { "name": "bar"}} print self.body # string with: '{"foo":{"name":"bar"}}' """

        body_kwargs = {}
        ct = self.get_header("content-type")
        if ct:
            ct = ct.lower()
            if ct.rfind("json") >= 0:
                body = self.body
                if body:
                    body_kwargs = json.loads(body)

            else:
                if self.body_input:
                    body = RequestBody(
                        fp=self.body_input,
                        headers=self.headers,
                        environ=self.environ
                        #environ=self.raw_request
                    )
                    body_kwargs = dict(body)

                else:
                    body = self.body
                    if body:
                        body_kwargs = self._parse_query_str(body)

        return body_kwargs