def viewset_model(serializer):
    """Get the model of a serializer."""
    if hasattr(serializer, 'serializer_class'):
        return serializer.serializer_class.Meta.model
    else:
        return None