'Parse the data into an instance of proto_type.'

def parse_protobuf(self, proto_type):

    if ('protobuf' not in self.environ.get('CONTENT_TYPE', '')):
        raise BadRequest('Not    a    Protobuf    request')
    obj = proto_type()
    try:
        obj.ParseFromString(self.data)
    except Exception:
        raise BadRequest('Unable    to    parse    Protobuf    request')
    if (self.protobuf_check_initialization and (not obj.IsInitialized())):
        raise BadRequest('Partial    Protobuf    request')
    return obj
