def type_check(self, instance):
      error_msg = ''
      for t in self.union_types:
        try:
          check_constraint(t, instance)
          return
        except __HOLE__ as e:
          error_msg = str(e)
          continue

      raise CompositeTypeHintError(
          '%s type-constraint violated. Expected an instance of one of: %s, '
          'received %s instead.%s'
          % (repr(self),
             tuple(sorted(_unified_repr(t) for t in self.union_types)),
             instance.__class__.__name__, error_msg))
dataset/ETHPy150Open GoogleCloudPlatform/DataflowPythonSDK/google/cloud/dataflow/typehints/typehints.py/UnionHint.UnionConstraint.type_check