def get_entity_and_id_colname(table):
    """Returns the entity and entity id column name from an id table,
    assuming the entity id column name is f'{entity}_id',
    and that this is the first (or only) column ending in '_id'.
    """
#     id_colname = table.columns[table.columns.str.contains(r'\w+_id$')][0]
    id_colname = table.filter(regex=r'\w+_id$').columns[0]
    entity = id_colname[:-3]
    return entity, id_colname