def METHOD_NAME(self, attrs):
    shared = attrs.get('shared')
    if shared not in (None, True, False, 'True', 'False'):
        raise serializers.ValidationError({
            'shared': "'{}' value must be either True or False.".format(shared)
        })
    attrs['shared'] = shared is True or shared == 'True'
    return attrs