'Return dirname associated with *index*'

def get_dirname(self, index):

    fname = self.get_filename(index)
    if fname:
        if osp.isdir(fname):
            return fname
        else:
            return osp.dirname(fname)
