def METHOD_NAME(serializer, code, **kwargs):
    if serializer.is_valid():
        serializer.METHOD_NAME(**kwargs)
        return Response(serializer.data, status=code)
    return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)