(type_sig, type_sig_name)
Checks that the given type signature is valid.

  Valid type signatures are either a single Python class, or a dictionary
  mapping string names to Python classes.

  Throws a well formatted exception when invalid.

  Args:
    type_sig: Type signature to validate.
    type_sig_name: Variable name of the type signature. This is used in
        exception descriptions.

  Raises:
    InvalidTypeSignatureError: If `type_sig` is not valid.
Checks that the given type signature is valid.
Checks that the given type signature is valid .
def _assert_valid_type_signature(type_sig, type_sig_name):
  """Checks that the given type signature is valid.

  Valid type signatures are either a single Python class, or a dictionary
  mapping string names to Python classes.

  Throws a well formatted exception when invalid.

  Args:
    type_sig: Type signature to validate.
    type_sig_name: Variable name of the type signature. This is used in
        exception descriptions.

  Raises:
    InvalidTypeSignatureError: If `type_sig` is not valid.
  """
  if isinstance(type_sig, dict):
    for k, val in type_sig.items():
      if not isinstance(k, six.string_types):
        raise InvalidTypeSignatureError(
            '%s key %s must be a string.' % (type_sig_name, k))
      if not inspect.isclass(val):
        raise InvalidTypeSignatureError(
            '%s %s at key %s must be a Python class.' % (type_sig_name, val, k))
  else:
    if not inspect.isclass(type_sig):
      raise InvalidTypeSignatureError(
          '%s %s must be a Python class.' % (type_sig_name, type_sig))
def _assert_valid_type_signature ( type_sig , type_sig_name ) : if isinstance ( type_sig , dict ) : for k , val in type_sig . items ( ) : if not isinstance ( k , six . string_types ) : raise InvalidTypeSignatureError ( '%s key %s must be a string.' % ( type_sig_name , k ) ) if not inspect . isclass ( val ) : raise InvalidTypeSignatureError ( '%s %s at key %s must be a Python class.' % ( type_sig_name , val , k ) ) else : if not inspect . isclass ( type_sig ) : raise InvalidTypeSignatureError ( '%s %s must be a Python class.' % ( type_sig_name , type_sig ) )