'Sanity checks'

def check_index(self, is_sorted=True, unique=True, index=None):

    if (not index):
        index = self.index
    if is_sorted:
        test = pd.DataFrame(lrange(len(index)), index=index)
        test_sorted = test.sort()
        if (not test.index.equals(test_sorted.index)):
            raise Exception('Data    is    not    be    sorted')
    if unique:
        if (len(index) != len(index.unique())):
            raise Exception('Duplicate    index    entries')
