+_BINARY_MATCHER = re.compile(r'bin"([\da-f]*)"').match
+
+def _deserialize_binary(s):
+ match = _BINARY_MATCHER(s)
+
+ if match is None:
+ return False, None, None
+
+ result = tags.TaggedObject(
+ tag = tags.BINARY,
+ instance = binascii.unhexlify(match.group(1)),
+ )
+
+ return True, result, s[match.end():]
+