def equal_list_elements(lst):    
    """Check all items in a list are equal. This is useful to check the equality of gpr object attributes prior to stacking."""
    i = iter(lst)
    i0 = next(i)
    try:
        assert all([i0 == j for j in i]) == True
        return(i0)
    except AssertionError:
        print('List elements are not equal.')
        exit(1)