'Re-set table options that depend on location_hierarchy
Only update tables which are already defined'

def update_table_hierarchy_labels(self, tablename=None):

    levels = ('L1', 'L2', 'L3', 'L4', 'L5')
    labels = self.get_location_hierarchy()
    db = current.db
    if (tablename and (tablename in db)):
        table = db[tablename]
        if (tablename == 'gis_location'):
            labels['L0'] = current.messages.COUNTRY
            table.level.requires = IS_EMPTY_OR(IS_IN_SET(labels))
        else:
            for level in levels:
                table[level].label = labels[level]
    else:
        if ('gis_location' in db):
            table = db.gis_location
            table.level.requires = IS_EMPTY_OR(IS_IN_SET(labels))
        tables = ['org_office', 'pr_address', 'cr_shelter', 'asset_asset']
        for tablename in tables:
            if (tablename in db):
                table = db[tablename]
                for level in levels:
                    table[level].label = labels[level]
