def positive_int(var, var_name):
    """
    Check if *var* is a positive integer.

    :raises TypeError: Parameter *var* must be an integer.
    :raises ValueError: Parameter *var* must be a positive integer.
    """
    if not isinstance(var, int):
        raise TypeError('\n\nParameter {} must be an integer.\n'.format(
            var_name))
    if var < 1:
        raise ValueError('\n\nParameter {} must be a positive integer.\n'.
            format(var_name))
