def check_max_tree_height(max_tree_height, allow_numeric=True):
    if (max_tree_height is None):
        max_tree_height = 'tree'
    is_numeric = isinstance(max_tree_height, numbers.Real)
    if ((max_tree_height not in ['tree', 'ts']) and (not allow_numeric)):
        raise ValueError("max_tree_height must be 'tree' or 'ts'")
    if ((max_tree_height not in ['tree', 'ts']) and (allow_numeric and (not is_numeric))):
        raise ValueError("max_tree_height must be a numeric value or one of 'tree' or 'ts'")
    return max_tree_height
def check_max_tree_height(max_tree_height, allow_numeric=True):
    if (max_tree_height is None):
        max_tree_height = 'tree'
    is_numeric = isinstance(max_tree_height, numbers.Real)
    if ((max_tree_height not in ['tree', 'ts']) and (not allow_numeric)):
        raise ValueError("max_tree_height must be 'tree' or 'ts'")
    if ((max_tree_height not in ['tree', 'ts']) and (allow_numeric and (not is_numeric))):
        raise ValueError("max_tree_height must be a numeric value or one of 'tree' or 'ts'")
    return max_tree_height