def _validate_subdomain(subdomain):
    """
    Validates the given subdomain.

    Parameters
    ----------
    subdomain : `None` or `str`
        Subdomain value.

    Returns
    -------
    subdomain : `None` or `str`
        The validated subdomain.

    Raises
    ------
    TypeError
        If `subdomain` was not given neither as `None` or `str` instance.
    """
    if subdomain is not None:
        if type(subdomain) is str:
            pass
        elif isinstance(subdomain, str):
            subdomain = str(subdomain)
        else:
            raise TypeError(
                f'`subdomain` can be as `None` or as `str` instance, got {subdomain.__class__.__name__}.'
            )

        if not subdomain:
            subdomain = None

    return subdomain