def string(var, var_name):
    """
    Check if parameter *var* is a string.

    :raises TypeError: Parameter *var* must be a string.
    """
    if var is None:
        return
    if not isinstance(var, str):
        raise TypeError('\n\nParameter {} must be a string.\n'.format(var_name)
            )
