code: def test_custom_tag():
      class Foo:  # noqa: B903, for Python2 compatibility
          def __init__(self, data):
              self.data = data
  
      class TagFoo(JSONTag):
          __slots__ = ()
          key = " f"
  
          def check(self, value):
              return isinstance(value, Foo)
  
          def to_json(self, value):
              return self.serializer.tag(value.data)
  
          def to_python(self, value):
              return Foo(value)
  
      s = TaggedJSONSerializer()
      s.register(TagFoo)
      assert s.loads(s.dumps(Foo("bar"))).data == "bar"
  
file_path: flask/tests/test_json_tag.py
imports: from datetime import datetime
  from datetime import timezone
  from uuid import uuid4
  import pytest
  from markupsafe import Markup
  from flask.json.tag import JSONTag
  from flask.json.tag import TaggedJSONSerializer
label_desc: Use image node_id 3 for calling a global function with example usage: test_custom_tag() and returns: isinstance, self, Foo