@classmethod
def attr_name_for_column(cls, column_name: str) ->str:
    """Get the class attribute name for a given database column name.

        This is used when setting instance values for :class`Column`'s, and
        allows access to the attribute name, whether the ``column_name`` was
        parsed using the actual database column name, or the attribute name
        (which can be different depending on the ``Column``).

        Example::

            >>> class User(BaseModel):
                    id = Column('_id', primary_key=True)
                    name = Column()

            >>> User.attr_name_for_column('_id')
            'id'
            >>> User.attr_name_for_column('id')
            'id'

        :param column_name:  The database column name to get the attribute name
                             for.
        :raises ValueError:  If no :class:`Column` is found for that column
                             name.


        """
    for attr_name, col in cls._columns():
        if col.key == column_name:
            return attr_name
        elif attr_name == column_name:
            return column_name
    raise ValueError(column_name)
