<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

async def wait_for_body_middleware(environ, start_response=None):
    '''Use this middleware to wait for the full body.

    This middleware wait for the full body to be received before letting
    other middleware to be processed.

    Useful when using synchronous web-frameworks such as :django:`django <>`.
    '''
    if environ.get('wsgi.async'):
        try:
            chunk = await environ['wsgi.input'].read()
        except TypeError:
            chunk = b''
        environ['wsgi.input'] = BytesIO(chunk)
        environ.pop('wsgi.async')