code: def validate_type_registry(option, value):
      
      if value is not None and not isinstance(value, TypeRegistry):
          raise TypeError("%s must be an instance of %s" % (
              option, TypeRegistry))
      return value
docs: Validate the type_registry option.