def _typecheck(name, value, *types):
    """
    Check that the given *value* is one of the given *types*, or raise an
    exception describing the problem using *name*.
    """
    if not types:
        raise ValueError('expected one or more types, maybe use _textcheck?')
    if not isinstance(value, types):
        raise TypeError("expected %s for %s, got %r"
                        % (" or ".join([t.__name__ for t in types]),
                           name, value))
    return value

    Check that the given *value* is one of the given *types*, or raise an
    exception describing the problem using *name*.
    
stackoverflow/venv/lib/python3.6/site-packages/hyperlink/_url.py