from typing import Any
import pathlib


def to_path(source: Any) -> pathlib.Path:
    """Converts 'source' to a pathlib.Path.
    
    Args:
        source (Any): source to convert to a pathlib.Path.

    Raises:
        TypeError: if 'source' is a type that is not registered.

    Returns:
        pathlib.Path: derived from 'source'.

    """
    if isinstance(source, pathlib.Path):
        return source
    else:
        raise TypeError(f'source cannot be converted because it is an '
                        f'unsupported type: {type(source).__name__}')