import pathlib


def _check_uri(uri):
    """Checks if the URI is valid and returns the string form of the URI."""
    if isinstance(uri, pathlib.Path):
        uri = str(uri)

    assert isinstance(uri, str),\
        "URI must be a 'str' or a 'pathlib.Path' instance"

    return uri