def get_serializer(self, *args, **kwargs):
        """
        Returns the serializer instance that should be used to the
        given action.
        If any action was given, returns the serializer_class
        """
        action = kwargs.pop('action', None)

        serializer_class = self.get_serializer_class(action)

        kwargs['context'] = self.get_serializer_context()
        return serializer_class(*args, **kwargs)
def get_serializer ( self , * args , ** kwargs ) : action = kwargs . pop ( 'action' , None ) serializer_class = self . get_serializer_class ( action ) kwargs [ 'context' ] = self . get_serializer_context ( ) return serializer_class ( * args , ** kwargs )
Returns the serializer instance that should be used to the
        given action.
        If any action was given, returns the serializer_class