def _type_error(actual, expected):
    """Returns a ValueError that the actual type is not the expected type."""
    msg = 'invalid type: %s is not in %s' % (actual.__name__,
                                             [t.__name__ for t in expected])
    return ValueError(msg)