code: def determine_struct_tree_subtype(self, data_type, obj):
          
          if '.tag' not in obj:
              raise bv.ValidationError("missing '.tag' key")
          if not isinstance(obj['.tag'], six.string_types):
              raise bv.ValidationError('expected string, got %s' %
                                       bv.generic_type_name(obj['.tag']),
                                       parent='.tag')
  
          # Find the subtype the tags refer to
          full_tags_tuple = (obj['.tag'],)
          if full_tags_tuple in data_type.definition._tag_to_subtype_:
              subtype = data_type.definition._tag_to_subtype_[full_tags_tuple]
              if isinstance(subtype, bv.StructTree):
                  raise bv.ValidationError("tag '%s' refers to non-leaf subtype" %
                                           ('.'.join(full_tags_tuple)))
              return subtype
          else:
              if self.strict:
                  # In strict mode, the entirety of the tag hierarchy should
                  # point to a known subtype.
                  raise bv.ValidationError("unknown subtype '%s'" %
                                           '.'.join(full_tags_tuple))
              else:
                  # If subtype was not found, use the base.
                  if data_type.definition._is_catch_all_:
                      return data_type
                  else:
                      raise bv.ValidationError(
                          "unknown subtype '%s' and '%s' is not a catch-all" %
                          ('.'.join(full_tags_tuple), data_type.definition.__name__))
docs: Searches through the JSON-object-compatible dict using the data type
          definition to determine which of the enumerated subtypes `obj` is.