def list_tuple_2elem(var, var_name):
    """
    Check if parameter *var* is a list/tuple with 2 elements.

    :raises TypeError: Parameter *var* must be a list/tuple.
    :raises ValueError: Parameter *var* must contain 2 elements.
    """
    if var is None:
        return
    if not isinstance(var, (list, tuple)):
        raise TypeError('\n\nParameter {} must be a list/tuple\n'.format(
            var_name))
    if len(var) != 2:
        raise ValueError(
            '\n\nParameter {} must be a list/tuple of length two.\n'.format
            (var_name))
