<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def marshmallow_loader(schema_class):
 """Marshmallow loader for JSON requests."""

    def json_loader():
        request_json = request.get_json()

        context = {}
        pid_data = request.view_args.get('pid_value')
        if pid_data:
            pid, _ = pid_data.data
            context['pid'] = pid

        result = schema_class(context=context).load(request_json)

        if result.errors:
            raise MarshmallowErrors(result.errors)
        return result.data
    return json_loader